50 ms·
> people that used Perl long ago but have since moved on to better languages For tasks where Perl is a good fit I moved to Python, but cannot say that it is be
by citrin_ru 6y ago
> people that used Perl long ago but have since moved on to better languages
For tasks where Perl is a good fit I moved to Python, but cannot say that it is better (or worse). It is much more fashionable, which is an advantage on its own though - more people will be able to read code written in Python, there are more libraries which are actively maintained.
Many years ago I used Pascal and now work with software written in C. In my opinion Pascal is much better language than C, but Pascal is mostly the thing of the past and C is still very much alive. Sometimes we have to move to languages which are worse or at best - not much better.
- erik_seaberg 6y agoPython has safer defaults. If you want lexical scoping, or errors when you make mistakes, you have to ask for it in Perl.
- harry8 6y agoIf perl had use strict; and -w (warnings enabled) by default so that you had to switch them off if you didn't want them I doubt python would have gained such traction as being "easier" and "more readable." The power of perl would have been better tempered by some responsibility. I liked perl and kinda miss it sometimes but I guess I'm not too unhappy about moving to python. Python is fine. I am pleased to find out how wrong I was about significant whitespace. Having the shape of the code reflecting its content and meaning is actually a great thing. You can think, this shape looks (un)pleasant before understanding the code in detail. Better yet is never, ever having yet another goddamn argument in a team meeting about python bracing style. Python's success makes it impossible to argue that people won't accept a mandatory indenting policy as part of the semantics of the language anymore. It's an open choice for all future languages to adopt if they deem it worthwhile, not refuse to entertain because "the users will revolt." With Perl's demise we still wait for the lisp of mass appeal for all perl as a lisp lacked uniform syntax.
- rswail 6y agoDo you use 2 spaces or 4 or 8 to indent? Leading tabs or spaces? /s
- harry8 6y agoYeah I get it, we'll do that about anything. And so I draw myself up my full height, hold up a hand, pause, then say "are you seriously trying to start an argument about python formatting? Seriously? Have you considered accounting as a career move?" And if you do it right it's not taken as malicious, gets a laugh and e move on to something else.
- bmn__ 6y ago> If you want lexical scoping […], you have to ask for it in Perl. That's false. Lexical scoping was added in 1994. One cannot ask for it, it's always "on". > Python has safer defaults. The parable of the mote and the beam is very opportune here. The Python defaults do not amount to much. Python has neither strict variables (demo: https://stackoverflow.com/a/34071474 https://stackoverflow.com/a/34071474) nor lexical scope (demo below). That makes it quite unsafe to program, similar to shell: a simple typo silently causes wrong results instead of being shown as error. The safe features cannot be simply enabled, the usual work-around is to use a programming language that implements these features and compiles down to Python. ---- Demo of lack of lexical scope: $ python3.8 -c 'for i in range(1,4): print(i) print(i)' 1 2 3 3 The variable leaks out. Compare JS (run-time error): $ node15 -e '[1,2,3].forEach(i => console.log(i)); console.log(i)' 1 2 3 ReferenceError: i is not defined Compare Perl (compile-time error): $ perl -Mv5.32 -E 'for my $i (1..3) { say $i; } say $i;' Global symbol "$i" requires explicit package name (did you forget to declare "my $i"?) at -e line 1. Execution of -e aborted due to compilation errors.
- erik_seaberg 6y agoYou’re right that Python only has function scope, not quite lexical scope. But perl -e ' sub foo { $x = 42 } foo; print "\$x is $x\n"; ' quietly creates a global variable. You have to ask for lexical scope, and you have to ask for strict mode to get that error (requiring 5.11 or better does that, but merely having 5.11 does not). Backward compatibility justifies this but devs need to beware this is how the language used to be.
- raiph 6y agoI'm curious if you're trying to highlight the wisdom or dramatic aspect of the Perl initiative that's the subject of the OP. ---- If you're not intending to highlight either of these things, then I suspect you perhaps haven't understood the OP. Perl has long had features that Perl folk consider better than Python's equivalents -- the issue you raise ('strict' lexical scoping) is an exemplar -- but Perl as it currently is has these features switched off (in the name of backwards compatibility). The proposal in the OP is that Perl folk will consensually agree on which of 30 years worth of accumulated advances in Perl to switch on by default, and then newbies will automatically get that improved Perl by default.