Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* ocamlc syntax and -i option
@ 1996-10-04 15:33 Utilisateur FNET
  0 siblings, 0 replies; only message in thread
From: Utilisateur FNET @ 1996-10-04 15:33 UTC (permalink / raw)



961004
(* ========================================================================= *)
Hi caml community,

Here are a few suggestions about ocaml, all opinions are welcome.

Thierry Bravier
Dassault Aviation.
DGT / DTN / ELO / EAV
78, Quai Marcel Dassault
F-92214 Saint-Cloud Cedex
France

Telephone : (33) 01 47 11 53 07
Telecopie : (33) 01 47 11 52 83
E-Mail :    bravier@dassault-avion.fr

===============================================================================
INFIX OPERATORS :
=================
Can `Foo.( + )' be used as an infix operator ?

# Pervasives.(+) 1 2;;
- : int = 3
# 1 Pervasives.+ 2;;
Syntax error

A prefix usage is available but a prefix usage would really be great
otherwise you'd have to open all module defining prefix operators.

Just suppose Pervasives were not open by default, you could not write
[1; 2] Pervasives.@ [3;4];;
but should write
Pervasives.( @ ) [1; 2] [3;4];;

===============================================================================
OCAMLC -i OPTION :
==================
I often find myself recompiling source code with the -i option just to
see the types.

Unfortunately this also recreates a .cmo / .cmi file as a side effect,
something not necessary (especially when you use make) when you just
want to look at types.

Would it be possible to have a `type-check-no object code' option that
could be used with or without the existing -i option ?

By the way, when using -i, if the type-checker finds a type-error you
do not get the types of previous correct values. This would be useful too
(as I often have to comment out the incorrect code to understand the error).

===============================================================================
FUNCTOR SYNTAX :
================
% cat foo.ml
module type DUMMY = sig val dummy : unit end
module type FUNCTOR_1 = functor (Dummy : DUMMY) -> DUMMY (* ok *)
module type FUNCTOR_2 (Dummy : DUMMY) = DUMMY            (* why not *)
% ocamlc -c foo.ml
File "foo.ml", line 3, characters 22-23:
Syntax error

This extension would make the syntax more homogeneous and much easier
for functors with multiple arguments

module type FOO (Ma : MA) (Mb : MB) (Mc : MC) = MZ

instead of

module type FOO =
   functor (Ma : MA) ->
      functor (Mb : MB) ->
         functor (Mc : MC) ->
   MZ

===============================================================================






^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1996-10-04 18:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-10-04 15:33 ocamlc syntax and -i option Utilisateur FNET

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox