On Sun, Jan 26, 2020, at 9:02 PM, shmem wrote: > Hi Porters, > > funny things doing you are. What's next? Are we seeing pragmas like > > - nowhitespace, to disable '$ { foo } = $ { bar }' > - nostmtmod to disable '$foo = $bar unless $baz' et.al. > - noautoload to disable AUTOLOAD > - nomultiline to enforce a semicolon on the line of a statement All of the above seems unnecessarily snarky when you could have just asked: > I don't get it. Could someone please enlighten me? > Why is crippling the language been thought as a feature? indirect method syntax is fairly rarely used, especially outside a small set of methods. On the other hand, it leads to a very common and (in my opinion) costly bug that converts would-be compile-time errors to runtime ones. Consider: perl -e 'try { sleep 10 }' Oops, the user forgot to `use Try::Tiny` — but instead of a syntax error at the unknown "try", we get Can't locate object method "try" via package "10" (perhaps you forgot to load "10"?) at -e line 1. …and we get it after a ten second delay. But imagine that this wasn't a contrived one-liner, but instead a large complex system in which that runtime error only occurs occasionally, or after a lot of other preparatory work is performed — possibly destructive work. Instead of failing to compile when an error was detectable at compile time, a lot of time — human and computer — is wasted by going to runtime. So, that is why this is a feature: it permits the detection of programmer error at an earlier phase. Finally, if you yourself would never make such an error, you do not need to disable this syntax, so this isn't crippling the language. It's adding another mode of operation that has an explicable benefit. -- rjbsThread Previous | Thread Next