[Grace-core] Some comments from Tijs on parsing Grace
James Noble
kjx at ecs.vuw.ac.nz
Wed Jul 27 04:55:46 PDT 2016
On 27/07/2016, at 23:09PM, Tijs van der Storm <storm at cwi.nl> wrote:
> but I guess this is about having both varags and lineups
not quite - the issue is that if you allow multiple-args "destructuring"
(don't have to be variadic) in definitions:
method single(a) { ... }
method double(a,b) { ... }
then when you're dynamically typed, there are problem cases
single(1) // works fine - "a" is bound to 1
double(1) // probably error from destructuring on receiver side
double (1,2) // , builds tuple, descrtructres fine
single (1,2) // "a" is bound to tuple (1,2)
single (1,) // "a is bound to oneple (1,)
from here, it's an obvious fix to allow only single arguments,
and have things explicitly destructure --- which is close to lineups
(except we also allow multiple flat arguments).
Either way, you have to make *another* distinction on the *caller* side
between calling
single(1) // works fine - "a" is bound to 1
single[1] //works fine - "a" is bound to [1]
we already have that of course with
single{1} but we seem to get away with that...
> (Btw, comma would then just be cons, not flat-cons, if you assume it's right associative, but I guess this is off limits for Grace ;).
yep. J
More information about the Grace-core
mailing list