Herby Vojčík wrote:
Herby Vojčík wrote:
Possible Smalltalk-inspired precedent is also:
(:x, y) x+y
(:x) (:y) "z"
(:x) (y) "z"
(:x) (y) (z)
I think I like this most...

Herby

We've talked about these variations, but they all seem grawlixy or worse (the C++ pre-11x bug with template instantiation nesting where you have to put a space between > and > to avoid writing a right-shift operator).

I agree this one is nicer but it's still grawlixy, or emoticon-y ;-). It does avoid the ambiguous grammar worry, on the up side.

The fat-arrow, =>, is better, and it can be made to work if we figure out and agree to pay for the spec-grammar validation against ambiguity work.

Maybe this could even be competely paren-free (tell me where it breaks):

  :x, :y x+y
  :x :y "z"
  :x (y) "z"
  :x (y) (z)

Imagine the code like coll.map(:x x*x) or coll.filter(:x x%2==1).


Formal parameter list syntax should include all the bells and whistles (rest parameter optional at end, paramater default values for trailing formals, destructuring patterns) so we should be conservative. One-parameter paren-free special casing, as in C#, is plausible.

x => x*x
(x,y) => x*y

Thanks for throwing out alternative syntaxes. We should keep beating on this anvil, shorter function syntax is well worth it. But we need a non-GLR parsing procedure that rejects ambiguous grammars.

/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to