4 ms·
>Perl actually happens to be impossible to parse Not actually true otherwise no Perl code could be run at all :) A more accurate description would be - Perl c
by draegtun 13y ago
>Perl actually happens to be impossible to parse
Not actually true otherwise no Perl code could be run at all :)
A more accurate description would be - Perl cannot be parsed unambiguously without runtime information.
For more detailed|interesting discussion about that Perlmonks post see this HN submission from 3 years ago - https://news.ycombinator.com/item?id=761103 https://news.ycombinator.com/item?id=761103
- lucian1900 13y agoIt's impossible to parse in the theoretical sense, since it requires information only obtainable through evaluation.
- snaky 13y agoAnd that's a necessarily a bad thing?
- ionforce 13y agoFor varying contexts of bad. It impedes on things like static analysis. You don't want the surface area of your programming language confined to 1) runtime 2) being run by a specific binary. Where is the offline tooling? Where is the variety? This handicap makes me despise Perl. And I say that as a long time professional Perl engineer.
- snaky 13y agoWhat the point of static analysis for dynamic language? >being run by a specific binary That's a not so appealing argument in particular case of Perl which level of reverse compatibility is hard to beat.
- ionforce 13y agoStatic analysis aids in finding common errors earlier in the development process. Also, what does reverse compatibility have to do with ease of parsing?
- snaky 13y agoGenerally speaking, static analysis is sometimes helpful for finding simple errors, yes. But how it's applicable to dynamic language like Perl? So, whether ease of parsing is a goal per se, or serve some purpose - what such a purpose can be in particular case of Perl?
- happy_dino 13y agoYes, absolutely.
- snaky 13y agoBecause ... ?
- happy_dino 13y agoThe idea of saying “Here is some file and I can't tell you whether it is valid Perl without executing it.” is magnitudes worse than all the C++ macro preprocessor and template hell combined. Something like that is pretty much the worst imaginable thing to happen in language design, especially because we know at least since Chomsky, Rice and Turing how to do better.
- snaky 13y ago>whether it is valid Perl And why that information may be valuable? You cannot say anything about whether it works or it doesn't. "This is valid C++ code, but it dumps a core on null pointer dereference here and there." -- is that information very useful? How exactly? I see an only one ephemerical goal that was a Holy Grail for academia and static analysis was primarily developed to approach it -- formal verification. But it's dead and buried outside an academia and noone cried at the funeral.
- happy_dino 13y agoThis is so stupid that I won't bother answering it. You just can't imagine how incredibly ridiculous it appears to the non-US world to use “academic” as a slur.