Earlier quoted context omitted.
Because with its declining popularity, most people here are unfamiliar with the language except for its meme status as "that weird line noise language". Things that confirm pre-existing beliefs are easy to accept and upvote, whereas good Perl code would require (a) some actual thinking, and (b) challenging the socially accepted narrative - both of which are relatively much harder.
Good Perl code would also look pretty boring, almost like enterprise Java. I'd wager that all code that "just works", in any language, looks bland and predictable. But I'd rather have that than cute and clever any day.
Perl code that is syntactically correct only on Fridays
201–210 of 233 posts
Re: Perl code that is syntactically correct only on Fridays
#202Re: Perl code that is syntactically correct only on Fridays
#203I don't get it! It is clearly written in the code, that the progam should behave this way. Is the proof, that perl is capable of this behaviour?! I don't get it - what is the point? I read all the comments and still don't get it. What am i missing?
f/1;#/+
is parsed differently depending on the day. On Friday it's [ "f", "/1;#/", "+" ]
Other days it's parsed as [ "f", "/", "1", ";" ].Perl is parsing /1;#/ is a regex based on whether f takes arguments. Otherwise it parses the slash as division and then the hash is a comment.
Another example could be:
foo() {
some_func / 1;#/; die "It died"
foo
}
Which depends on some_func to not halt. some_func could come from another file, set by whoever invokes the current file. Whatever, it's determed at runtime.This leads to a proof that perl is a actually impossible to parse.
https://www.perlmonks.org/?node_id=663393
Which means you can't do a lot of static tooling on perl because you just can't analyses the source accurately. (Compared to say python, which parses source before running it)
Re: Perl code that is syntactically correct only on Fridays
#204Why only things like these float up to the front page, and not elegant and/or wholesome things written in Perl?
perl -e 'print "foo\n" for 1..99999; print "bar\n";' > foobar.txt
Re: Perl code that is syntactically correct only on Fridays
#205I had an intern once who wrote similar code. They confused 12 hour and 24 hour clocks, so the code would break after lunch. Unfortunately, the intern only worked the mornings, so it took several days of back and forth before the bug could be finally put to rest.
We had situation where if you worked late, the test suite would consistently fail. Since developers rarely worked late and would give up when hitting the "random" test suite failure and go home, the bug persisted for months before the true cause was understood. Our time zone was UTC-5, and the test suite contained a local-vs-UTC bug which only triggered between 7pm and midnight.
Re: Perl code that is syntactically correct only on Fridays
#206Earlier quoted context omitted.
Thank you for this. I hate trying to read Perl so much. What is the "#/+" for?
Worked as a Perl dev for 15 years and enjoyed it. The hardest thing was the number of ways to do OO Perl using Perl5. Everyone has their own flavor. And TMTOWTDI was a motto the community was proud of. Having said that, nothing could touch mod_perl performance under Apache in the late 90s. Massive web apps were built on this including eToys dot com where I worked before it imploded in the dot-com bust.
Re: Perl code that is syntactically correct only on Fridays
#207Earlier quoted context omitted.
Worked as a Perl dev for 15 years and enjoyed it. The hardest thing was the number of ways to do OO Perl using Perl5. Everyone has their own flavor. And TMTOWTDI was a motto the community was proud of. Having said that, nothing could touch mod_perl performance under Apache in the late 90s. Massive web apps were built on this including eToys dot com where I worked before it imploded in the dot-com bust.
> Worked as a Perl dev for 15 years and enjoyed it Similar situation here. Perl is awsome and I'm still bitter that Python won. I mean significant whitespace - what great madness is this??? Anyway, yes, mod_perl ran the Web for about a decade in the early 2000s and I built and maintained huge websites which were all Perl on the back end. BTW the book "Perl Best Practices" by Damian Conway [0] is the best general prog…
Re: Perl code that is syntactically correct only on Fridays
#208Earlier quoted context omitted.
Worked as a Perl dev for 15 years and enjoyed it. The hardest thing was the number of ways to do OO Perl using Perl5. Everyone has their own flavor. And TMTOWTDI was a motto the community was proud of. Having said that, nothing could touch mod_perl performance under Apache in the late 90s. Massive web apps were built on this including eToys dot com where I worked before it imploded in the dot-com bust.
Perl makes you think differently. True for all languages I guess, but maybe a little truer for Perl than most. I've moved on but still use it for simple scripting tasks despite doing my best to learn Python. I just feel so expressive and unconstrained writing it, for better or worse.
Re: Perl code that is syntactically correct only on Fridays
#209Randal has been doing nothing but this for at least 20 years.
Re: Perl code that is syntactically correct only on Fridays
#210Why only things like these float up to the front page, and not elegant and/or wholesome things written in Perl?