Can You Expand Arrays into an Argument List?
surlymoor
surlymoor at cock.li
Fri May 15 18:44:52 UTC 2020
Hello,
I don't often miss JS, but one particular feature that I enjoyed
is the ability to expand arrays into argument lists using a unary
operator.
Example: add(...[1, 1]) === add(1, 1) // IIRC
I've been looking in Phobos and the spec, but nothing's popped
out to me. Is there a fairly obvious alternative to this, or am I
going to have to experiment with some templates and mixins? (Not
that I mind, btw, D's metaprogramming is very fun.)
With thanks,
sm
More information about the Digitalmars-d-learn
mailing list