News for hackers. Stuff that matters.
Re:ECMAScript 6 looks promising by masklinn on Thursday November 24, 2011 @12:38PM (#3274917)
> What would you do if you need just the first 5 elements of a 100-element long list?

Depending on the language, either you don't or you use a "everything else" operator to an unused variable:

    a, b, *_ = list
You could even alter the syntax slightly to put a "Don't care" placeholder:

    a, b, * = list
same as above but does not require serializing the [2:] array slice.
Re:ECMAScript 6 looks promising by adgar on Thursday November 24, 2011 @03:18PM (#3275316)
Ruby unfortunately has non-strict destructuring, but it also has LHS splatting:

a, *, c = list

And people often use _ as a placeholder when not using splatting:

a, _, _, c, d = list