logoalt Hacker News

9rxlast Tuesday at 7:47 PM1 replyview on HN

What else would you want to do with them? Maybe in rare cases you'd want to structure them into an array or something, but the inverse isn't possible either [e.g. func f(a, b, c int) -> f(<destructure array into arguments>)] so it isn't like it is inconsistent.

Perhaps what you are really trying to say is that multiple function arguments is insane full stop. You can pass in an array/tuple to the single input just the same. But pretty much every language has settled on them these days – so it would be utterly bizarre to not support them both in and out. We may not have known any better in the C days, but multiple input arguments with only one output argument is plain crazy in a modern language. You can't even write an identity function.


Replies

throwawaymathslast Tuesday at 8:05 PM

have a single return value and if you really need MRV, return as a tuple type, which you could destructure.

(this is what zig does)

show 1 reply