[nem-en] Parentheses
Michal Moskal
malekith at pld-linux.org
Fri Sep 10 13:42:46 CEST 2004
On Fri, Sep 10, 2004 at 01:17:38PM +0200, Maurizio Colucci wrote:
> Ah, now I see what you mean. But that is not necessary: that is just the way
> haskell/ocaml happen to treat that syntax. Nemerle doesn't need to do that. I
> mean, you don't need to support the concept of partial application to allow
> that syntax. You could even put a preprocessing step that translates
>
> f g (h x);
>
> into
>
> f(g, h(x));
>
> , that is, completely mechanically. That's why I don't understand why Michal
> says the ocaml syntax is more ambiguous. To me, there seems to be one-to-one
> correspondence.
f x + 1. It's far from obvious what's going on here. Of course there is
a rule, it's (f x) + 1, but this is not obvious.
> I agree that is SLIGHTLY more difficult to understand which is the functor and
> which is the argument, but you quickly learn, and the ocaml idiom always has
> one parenthesis less.
Nope:
f (x + 1) (x - 1) (v * 12)
vs:
f (x + 1, x - 1, v * 12)
> Which is much desirable, considering that MOST OF THE
> TIME you write things that needs only one parenthesis:
>
> Nemerle:
>
> def x = f(y, z);
>
> ocaml:
>
> let x = f y z;
>
> This is a simplification that really makes your life easier, on the long run.
> Consider it takes two minutes to get used to the ocaml idiom, whereas you
> have to type parentheses more for the rest of your life. :-)
For me, typing is not the most timeconsuming part of programming.
But again, you will be able to implement this as a macro, when the new
parser is completed.
--
: Michal Moskal :: http://www.kernel.pl/~malekith :: GCS !tv h e>+++ b++
: ::: Logic is a nice contrast to the Real World. :: UL++++$ C++ E--- a?
More information about the devel-en
mailing list