Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] syntax foo
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Lauri Alanko <la@i...>
Subject: Re: [Caml-list] syntax foo
On Wed, Feb 06, 2002 at 07:25:55PM +0100, Markus Mottl wrote:
> On Wed, 06 Feb 2002, Brian Rogoff wrote:
> > The syntactic differences between Haskell and OCaml are insignificant
> > beside the semantic ones.
> 
> This is definitely not true: Haskell is sensitive to layout, which alone
> makes it very different from a syntactic point of view. Though this
> lets Haskell-programs look very nice to the human eye, it also makes
> other things more difficult, e.g. using preprocessors or automatic code
> generation. The parser is also more difficult to implement.

Note that the layout rule in Haskell is _optional_. You can always use
explicit braces and semicolons and forget about indentation. So at least
your point on code generation doesn't hold.

Personally, I find Haskell's syntax (with or without the layout rule)
infinitely more convenient than OCaml's. Anything that uses "end" to mark
the end of a block is hopelessly clumsy and old-fashioned. :)

The sorest lack in both the old and the revised syntax is the need for a
let*-form, ie. a sequence of bindings, each of which is in the scope of the
previous ones. I _so_ hate doing this:

let foo = bar in
  let baz = quux in
    let fnord = fnarp in
      ...
      
Here foo occurs free in quux and baz occurs free in fnarp. So I have to
write "in let" between every binding, which is annoying, as is also the
nesting. I would prefer something like this:

let* foo = bar;
     baz = quux;
     fnord = fnarp; 
in
     ...
     
(Possibly even without the "in", it is also ugly.)

That should be enough whining for now. Thankfully, camlp4 allows everyone to
fix these issues according to their own preferences.


Lauri Alanko
la@iki.fi
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr