Worst ideas/features in programming languages?
snarwin at gmail.com
Wed Jan 5 22:37:03 UTC 2022
On Wednesday, 5 January 2022 at 06:33:39 UTC, Walter Bright wrote:
> On 1/3/2022 7:09 PM, Timon Gehr wrote:
>> To be very clear, I want this:
>> An this is generally what people mean when they talk about
> I understand. It looks like a worthy goal.
Is this really necessary or even desirable? Tuples do not
auto-expand like this in other languages. For example, in Python:
tup = (1, 2, 3)
fun(1, 2, 3) # prints "3"
fun(tup) # prints "1"
Even without automatic tuple expansion, Timon's example could be
written as follows:
alias apply(alias fun) = (args) => fun(args.tupleof);
[(1,2), (3,4)].map!(apply!((a, b) => a+b)).each!writeln;
More information about the Digitalmars-d