Hacker News new | ask | show | jobs
by prodigal_erik 4172 days ago
Not explicit enough. Perl is the only language I've ever seen where

  sub f { return 1, 2 }
  my %x = (a => f(), b => f());
produces a three-element hash that has '2' as a key and 'b' as a value with no warnings. "Even offsets are keys" is far more error-prone than an actual syntax for hash literals, and splicing a list (not a hash!) into a hash doesn't need syntax this terse because it's hardly ever what I wanted. I think even PHP is more sane here.
1 comments

I think even PHP is more sane here.

I'm not sure how an appeal to PHP as lowest-common-denominator of language sanity argues against understanding the return values of functions you call.

> understanding the return values of functions you call

Sure you should. But confusion between keys and values isn't useful, so there's no reason for a subexpression to be able to do that, and in PHP it can't.