Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: bravier@dassault-avion.fr (Utilisateur FNET)
Subject: ocamlc syntax and -i option
Date: Fri, 4 Oct 1996 16:33:20 +0100	[thread overview]
Message-ID: <9610041533.AA02917@fnet-ia1.dassault-avion.fr> (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

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






                 reply	other threads:[~1996-10-04 18:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9610041533.AA02917@fnet-ia1.dassault-avion.fr \
    --to=bravier@dassault-avion.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox