|
On 20/10/15 03:10 PM, Dirk Laurie wrote:
2015-10-20 18:34 GMT+02:00 Soni L. <fakedme@gmail.com>:On 20/10/15 02:00 PM, Andrew Starks wrote:My biggest complaint, and it is a very small critique, is simply the awkwardness of typing `select('#', ...)`. `#(...)` would be nicer to type, but the implications of this are not known to me.`#...` would be nicer to type, `(...)` is an expression so `#(...)` actually returns the length of the first value in `...` (just like the current `#...`)`##` would be even nicer to type. Tom has pointed out that my suggestion that #index becomes a `select` shorthand when index is an integer is unimplementable, but for numeric literals #1, #2 etc it is possible. (And in Ravi, of course.)
No need for ##, just use a # with no arguments. Ofc, local x = # (x)(y) is ambiguous, but so is local x = f (x)(y)So: # for varg len, ...[x] for indexing a varg, ...[x]=y for setting a varg (it shouldn't allow out-of-bounds tho because optimization).
... should still get all varargs and you should still use select() if you want to skip some varargs (e.g. f(select(3,...)) won't do the same as f(...[3])) (also we need a deselect(n, ...) which strips all varargs after the nth. a reverse(...) could be done in just 3 lines with this proposal so it isn't needed.) but this'll make varargs closer to first-class citzens (you'll still need coroutines to store them).
-- Disclaimer: these emails may be made public at any given time, with or without reason. If you don't agree with this, DO NOT REPLY.