From: Pierre Weis <weis@pauillac.inria.fr>
To: christo@nextsolution.co.jp (Frank Christoph)
Cc: caml-list@pauillac.inria.fr
Subject: Re: Language improvements (?)
Date: Wed, 24 Jul 1996 10:44:17 +0200 (MET DST) [thread overview]
Message-ID: <199607240844.KAA21840@pauillac.inria.fr> (raw)
In-Reply-To: <9607240630.AA00506@sparc3.nextsolution.co.jp> from "Frank Christoph" at Jul 24, 96 03:30:32 pm
> Third, since the trend in O'Caml is toward curried function types, it would
> be useful to be able to section binary operators as in Haskell, e.g., "(1+)"
> would mean "(function x -> 1 + x)".
Wao! Is this so useful ?
> And, at the risk of instigating a syntax war, I would prefer a more
> Haskell-like syntax overall; for example, offside scoping,
By ``offside scoping'', you mean a ``where'' construct, I presume ?
> uppercase types so
> there is no need for quotes in front of type variables,
No, no, we already exhausted uppercase conventions with modules, constructors,
labels, and let bound identifiers. You may add one more convention to
get rid of the ' for type variables, but it cannot be as trivial as
just ``the first character is lower (resp. upper) case''. You need
something a bit more complex, for instance ``the LAST character must
be lower (resp. upper) case'' (with the side condition ``the
identifier must be at least 2 characters long''. I prefer to write
some ' here and there in my programs.
> and user-definable
> symbolic binary operators... <sigh> Then again, I guess there's no point in
> turning O'Caml into an eager Haskell. Anyway, I suppose there is a
> philosophical reason why there are no user-defined symbolic identifiers in
> Caml although SML allows them.
I don't know exactly what you mean by a ``symbolic identifier'', if
you mean an identifier entirely made of characters that are not
letters or parens (e.g. ++ or <=> or >>), then Caml support it.
These identifier are infix operators, and their precedence is the same
as the precedence of the operator corresponding to the first character
(e.g. +* gets precedence of +).
For instance you may like to define your own << operator as in C:
Objective Caml version 1.01
#let (<<) x y = x lsl y;;
val << : int -> int -> int = <fun>
#1 << 4;;
- : int = 16
Or with a more imperative point of view:
#let (+=) r x = r := !r + x;;
val += : int ref -> int -> unit = <fun>
#let r = ref 0 in r += 2; !r;;
- : int = 2
Pierre Weis
INRIA, Projet Cristal, Pierre.Weis@inria.fr, http://pauillac.inria.fr/~weis
next prev parent reply other threads:[~1996-07-24 8:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
1996-07-24 6:30 Frank Christoph
1996-07-24 8:44 ` Pierre Weis [this message]
1996-07-24 9:53 ` Frank Christoph
1996-07-24 17:04 ` Georg Bauer
1996-07-25 2:12 ` Ian T Zimmerman
1996-07-25 12:26 ` Michel Mauny
1996-07-25 17:14 Pierre Weis
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=199607240844.KAA21840@pauillac.inria.fr \
--to=weis@pauillac.inria.fr \
--cc=caml-list@pauillac.inria.fr \
--cc=christo@nextsolution.co.jp \
/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