#64 &as cannot be used together with & rest a month ago

Comment by ~gandor on ~technomancy/fennel

Makes perfect sense to me too (after all, this was my initial intuition).

#64 &as cannot be used together with & rest 2 months ago

Comment by ~gandor on ~technomancy/fennel

I'm not so sure about that... &as preceding & rest would be very confusing and counter-intuitive IMO. (One might think that &as refers to the preceding arguments only.) At the very first position - [&as all x y z & rest] - it might make a bit more sense, but still hard to read. (Definitely better than in the middle though.)

#64 &as cannot be used together with & rest 2 months ago

Comment by ~gandor on ~technomancy/fennel

Sure, here's a real-life example from a Neovim plugin - a rare, but valid use case, when the head (first), the tail (rest), and the whole table (positions) are all referenced later. (This occurs at maybe one or two other places in that script.)

#64 &as cannot be used together with & rest 2 months ago

Ticket created by ~gandor on ~technomancy/fennel

> (local [a b & rest &as t] [1 2 3 4 5])
Compile error in unknown:12
  expected rest argument before last parameter

* Try moving & to right before the final identifier when destructuring.

It would be great if this case could be handled somehow, as it would allow for eliminating a let-block and a nesting level in many places.