4 ms·
I've said it before and I'll say it again: other imperative scripting languages feel like incomplete subsets of Perl. And the community is fantastic.
by gatlin 15y ago
I've said it before and I'll say it again: other imperative scripting languages feel like incomplete subsets of Perl. And the community is fantastic.
- TylerE 15y agoThis is the language that doesn't have proper function arguments, exceptions, objects, etc, and you're calling OTHER languages a subset? Sorry, I just don't see it. What exactly is so awesome in Perl that isn't easily done in Python/Ruby/Scala/D/Haskell?
- gatlin 15y ago> proper function arguments my ($a, $b, $c) = @_; # this works Or I can do things like my ($first, @rest) = @_; giving me features which require all manner of annoying syntax in Python. > exceptions http://search.cpan.org/~nilsonsfj/Error-TryCatch-0.07/lib/Error/TryCatch.pm http://search.cpan.org/~nilsonsfj/Error-TryCatch-0.07/lib/Er... or just eval and see what the output is. > objects Edit: I was being an asshole Perl has a decent object system out of the box and Moose for those times when you want type constraints. package MyClass; use base 'Parent'; sub new { my $class = shift; bless { prop1 => undef }, $class; } package main; my $obj = new MyClass; > etc Lexical scoping, anonymous coderefs that can be passed as data, modifiable syntax, reference semantics, and the regex engine I see other languages comparing theirs too.
- kbd 15y ago> giving me features which require all manner of annoying syntax in Python def foo(first, *rest): vs sub foo{ my ($first, @rest) = @_; ?
- Mithaldu 15y agouse Method::Signatures; func set (Str $key, Int $val) {
- gatlin 15y ago>>> def foo(first, *rest): ... print first ... print rest >>> foo([1,2,3]) [1,2,3] () * sub foo { my ($first,@rest) = @_; print $first . "\n"; print @rest; } foo (1,2,3); 1 23 * It's probably my Python deficiency. My claim that Python's syntax was going to be uglier is probably wrong, but I think the claim that Perl's is appreciably worse is also wrong. We can all get along!
- phaylon 15y agoExactly, it's a trade-off. Making the other side of the fence not impossible to reach, you just have to hop a little. Perl can easily be made nicer and Python can surely with ease be made more flexible.
- TylerE 15y agoNot sure I follow you. Your python example is very explicitly passing a _single_ arguement, a list of three items. If you call it the same way you call the perl code, you'd have the same result.