4 ms·
It follows Perl's philosophy very closely. As an example: in Javascript, the binary + operator means either addtion or concatenation, depending on the type of
by perlgeek 17y ago
It follows Perl's philosophy very closely.
As an example: in Javascript, the binary + operator means either addtion or concatenation, depending on the type of the left-hand side. In Perl there are different operators for that, + for addition and . for concatenation.
That means that you have more operators, but you need less type conversions, because they happen implicitly.
This now follows the same philosophy: different operations have different names. List reversal is not the same as string reversal. Neither is hash inversion.
Within this context it's the most logical thing you can do.
- tptacek 17y agoWait, nothing you just said makes renaming "reverse" "flip" more logical.
- masak 17y agoSir, I have a frivolous data point for you. It's from a blog post I wrote shortly after the change from 'reverse' to 'flip' for strings (<http://use.perl.org/~masak/journal/38800 http://use.perl.org/~masak/journal/38800 >): "Strangely enough, nothing happened when clicking the 'flip!' link... a moment's reflection gave the cause of this: a few days ago, [Larry Wall] has syntactically separated reversal of List (.reverse) from the reversal of Str (.flip); my code was like three weeks old and was still using .reverse for strings, which in the newest Rakudo got interpreted as one-elem lists, and list-reversed with no visible effect whatsoever. I fixed that, and found the fact that the link in the Lobster app was already called 'flip' an indication of the appropriateness of the name change. Perl 6 just keeps getting nicer and nicer." The relevant piece of background is that I was porting the example application (Lobster) from the Rack framework, where the link was already called 'flip'. So, suddenly both the link and the method were called 'flip'.
- perlgeek 17y ago"reverse" wasn't renamed to "flip", just one of the two possible meanings of "reverse" was renamed. reverse() still exists and reverses lists.
- deleted 17y ago[deleted]