top | item 26667255

(no title)

BGZq7 | 4 years ago

Yes, I definitely miss this in Ruby since it also has optional parens for method calls but lacks sigils. Even the most basic-looking expressions can have arbitrarily complicated meanings:

  foo.bar = 1
Is that just an attribute set on an object, is it calling a method foo that returns an object containing a bar attribute with a normal getter/setter, or is bar= a method that has arbitrary functionality?

I also like the more explicit operators in Perl that help show context:

  $foo + $bar
This is specifically numeric addition and those operands are probably at least somewhat number-like. Yes you can potentially overload it, but by convention, it will still be something like addition, so you don't have to wonder if you are adding, concatenating, appending a list, or something else, because they have different operators.

discuss

order

No comments yet.