4 ms·
Ah, I see. Thank you. No, the reason for the word 'flip' being used is not due to a bizzarre Perl idiosyncrasy about context-based evaluation -- quite the oppo
by masak 17y ago
Ah, I see. Thank you.
No, the reason for the word 'flip' being used is not due to a bizzarre Perl idiosyncrasy about context-based evaluation -- quite the opposite. Note that the change to using 'flip' is in Perl 6 only (this is not one of those changes that newer versions of Perl 5 has adapted; nor, I suspect, will it ever). Perl 6 does not do the context-base idiosyncrasy thing, and the resulting consistency quite naturally led to the two concepts being separated.
Sure, we could still call both the list operation and the string operation the same thing ('reverse', say), but that would lead to unfavourable corner cases and breakage of the rule of Least Surprise. ("Hey, why does it write my list of one string backwards?")
So, after Perl 6 has removed a function being polymorphic based on list/scalar context, and then removed nasty corner cases, your objection that this is not how "every language from Javascript to Haskell" does it might still be valid, but it might not weigh as heavily against the gain in consistency.
- tptacek 17y agoThanks for the clarification. If you can't tell, it's been awhile since I had to write Perl.