[nem-en] Parentheses
Pawel W. Olszta
pawel.olszta at gmail.com
Wed Sep 8 16:47:29 CEST 2004
Hello Maurizio,
> With the ongoing update to the type inference (I read the Monologue :-)), the
> only thing that is holding me back from using Nemerle (instead of ocaml) is
> the heavy notation with too many parentheses, especially for lambdas:
>
> Nemerle:
>
> List.Map ([B()], fun (x) { x.foo });
>
> Ocaml:
>
> List.map [new B] (fun x -> x#foo)
I've made a little experiment and you'll probably be able to write:
List.Exists ([1, 2, 3, 4, 5], lambda x -> x == 3)
The (very simple) `lambda' (as the `fun' keyword is already taken and
our parser can't differentiate between the two constructions
automatically yet) macro should make it to tonight's snapshot unless I
fail to convince Kamil, who's opposing to pollute the language with
such syntactic sugar.
> I understand the syntax is meant to be similar to C#, but this should be taken
> into consideration. Does nobody feel this as a problem?
Personally, I am a natural born LISP person :)
> PS: Even better would be:
>
> List.Map [B()] (fun x -> x.foo);
>
> but I understand this would make too much of a change.
This looks like partial application to me and we're not supporting that.
> PPS: And what about removing () from B()?
You need the () to differentate the construction of an instance of
type B from referencing the type B. Moreover the `B ()' notation is
consistent with the rest of the language.
And I'd hate to see `()' being replaced by the `new' keyword, it seems
redundant to me as you have to write the parens anyway if the called
constructor has any parameters ;]
Thanks to your feedback, I have a feeling that this topic is going to
attract a lot of attention :)
Pawel Olszta
--
It's not the fall that kills you, it's the landing.
More information about the devel-en
mailing list