4 ms·
As a Perl fan, I think that's a valid point. It takes five minutes of a good tutorial to understand what references are and how they work. Yet it's not rare to
by TurboHaskal 11y ago
As a Perl fan, I think that's a valid point.
It takes five minutes of a good tutorial to understand what references are and how they work. Yet it's not rare to see so called senior developers still failing to use them properly and introducing bugs because of it.
- pflanze 11y agoI too think it's a fair point; Perl tends to have too many syntactical features that take up processing power in the brain: JavaScript style foo.bar.baz is just lower overhead than $foo->{bar}{baz} or $foo->{bar}->{baz} or $$foo{bar}{baz} or if foo is a hash variable, $foo{bar}{baz} or variants. The brain has to filter out whether the first variable holds a reference or is a hash variable, then has two different dereference syntaxes to choose from (ok JavaScript has two variants, too), then later '->' are optional. You get used to it, but it still draws some attention away from the more interesting parts of a program. In a way my project improves a bit over this, since you're often not using Perl base data structures directly anymore; OTOH of course that means writing out a function or method call, and while this is more universal (which I like) it also uses more space to type. Also, sigils are getting more pointless when using libraries (I usually don't use % and @ anymore, always references, the good part of which is that this is giving a bit more consistency).
- kbenson 11y agoI would argue that it less adds cognitive load than it shifts that load from other portions of the language. Dealing with references makes some operations (such as telling if two variables contain the same data in memory) very easy, while making others (such as top level access to hash/array items) harder. I think that it makes some advanced operations easier to understand at a glance and reason about at the expense of those unfamiliar with the language (or references in general).