Re:Perl 6 hands-on tutorial – A small introduction to a big ...
by singingfish on Friday September 04, 2015 @08:49AM
(#10170046)
I have two trite one-liners about perl(5) in comparison and to other languages these days.
1. Python helps you think more like the computer does. Perl helps the computer think more like you.
2. Modern Perl is C# for hippies.
Re:Perl 6 hands-on tutorial – A small introduction to a big ...
by raiph on Friday September 04, 2015 @01:24PM
(#10171759)
Have you seen https://www.youtube.com/watch?v=JpqnNCx7wVY?
If you read a little farther you might have seen this: Note: .VAR and .WHAT are code smells. They’re useful to understand the language and debug, but testing against what they return is nearly always the wrong approach.
> Because it looks like a "piece of string" ... that ties ... strings together, apparently.
You're mistaking a mnemonic for the reasoning. The reasoning is most likely because using a period for string concatenation is likely to cause problems when it's also used for method calls and strings can have methods, and when methods can be quotes. E.g. "foo"."chars"(), which might be useful with string interpolation.
As for why it's not +, that's covered as well. Perl takes the stance that operators should be different for different operation types. What does foo + bar mean in python? You need to know the types of foo and bar to know that. In Perl 5 and Perl 6, you know whether you are adding numeric types or concatenating (not adding) strings.
It's easy to assume no thought went into the development[1], but it's been very well thought out and been baking for a very long time. They spent that time actually testing their ideas, and making changes when reality didn't match expectations.
1: for that matter, a lot of people think that about Perl 5, which is untrue, it just has different design goals than many languages