What went wrong Sup Forums?

What went wrong Sup Forums?

Other urls found in this thread:

swtch.com/~rsc/regexp/regexp1.html
sites.google.com/site/steveyegge2/tour-de-babel
twitter.com/NSFWRedditImage

Ruby happened

But Ruby is gay...

A few things.

One: MTOWTDI is a horrible fucking philosophy and is why 98% of perl code is write-only.
Two: They took WAY TOO FUCKING LONG on getting the Perl6 spec out. All the shifts in programming practices never happened in Perl because they never fucking updated the language for it.
Three: When Perl6 was finalized, it's not even goddamn backwards compatible. You couldn't fuck that up harder if you actively tried.
Four: The syntax is ugly as shit and there's too much emphasis on special variables like $_ and $"

Perl is bliss.
#!/usr/bin/perl
# convert space delimiters to tab
open IN, $ARGV[0];
while(){
chomp;
$_ =~ s/ /\t/g;
print $_,"\n";
}close IN;

What's hard to understand? Perl is perfect

Ruby does not exist.

I work with one of our clients very closely because my company doesnt understand the concept of "not our job", so I have to deal with Perl day in and day out.

I like it for a lot of reasons. I find it very natural and comforting to work with.
But the amount of one-liner Perl-Magic bullshit I have to fucking decipher and rewrite to update some function somewhere is god damn DISGUSTING.

Perl RegEx is GOAT
Perl one-liners are GOAT

perl -pi -e 's/Cuck/Faggot/gi' FILE


#!/usr/bin/perl
use strict;
use warnings;
my $op = "cuck";
for (my $i=0; $i

manages to be less readable than bash scripting.

hell bash even has function arguments lol.

>I like it for a lot of reasons. I find it very natural and comforting to work with.
This and there is no significant whitespace like Shit-thon. Perl was designed by a linguist and is naturally natural.

However, if a Perler is not using recommended syntax then it gets hard to read. Thus the write-only complaint it gets a lot.
>one-liner Perl-Magic bullshit
Actually I could have made that script into a one-liner

perl -pi -e 's/ /\t/g' FILE

To be honest, I am a biology grad student and Perl used to be the language of choice for biologists, now it's Python. But in my field 90% of the work is string manipulation and RegEx. So Perl is a natural choice, and faster to script than Python in my opinion.

I get the hate for Perl but honestly, programming is a tool set, and Perl is a unique tool. Everyone has to use a hammer (C/C++/Java/ whatever). But some people really need a torx screwdriver sometimes.

>function arguments lol.
What do you mean?
sub max {
my ($a,$b) = @_;
undef my @a;
push @a, $a; push @a, $b;
@a = sort {$b$a} @a;
return shift @a;
}

> my ($a,$b) = @_;

literally fucking that.
it's fucking stupid.

Perl is garbage.

I love Perl when it's not le-epic-unix-h4xor bullshit. It's genuinely a fantastic language with a tremendous amount of capability, and its FAST.
But it suffers horribly from one-liner magicks and uncommented legacy insanity.

Ruby and Python very clearly inherited it's MTOWTDI philosophy and their "english-like syntax" is clearly directly taken from Perl, but they're both slower and inferior for a lot of reasons.
I don't think people realize that either, Python always gets this praise for "its so readable!" but it's literally just Perl syntax without all the $

TMTOWTDI
my $string = "FOO";
my @lines = split /\n/, qx'grep $string $ARGV[0]';
foreach(@lines) { print "$_\n"; }

>Faster than it's children
>Not faster than assembly code designed specifically for one task
who would have thought

No it's awesome :^)
sub max {
my ($a,$b) = @_;
my $c = 0; my $d=0;
$c = shift @_ if(@_ > 0);
$d = shift @_ if(@_ > 0);
undef my @a;
push @a, $a; push @a, $b; push @a, $c; push @a, $d
@a = sort {$b$a} @a;
return shift @a;
}


See how great Perl is!

>multiple assignment is stupid
That shit saves so much fucking time. I wish more languages supported it.

You don't seem to understand. Look at that fucking scaling: it's exponential.
If you look at the y-axis, it's scaled logarithmically just so you can see all of the lines on the same graph.
It's not just a few milliseconds slower; with an input that's not even that large, it's literally billions of times slower.

It all because perl """regular expressions""" aren't even regular, and take a massive dump on the CS theory that actually makes regular expressions good.
Here is the article I got the image from, and also has a good explination: swtch.com/~rsc/regexp/regexp1.html

>I don't think people realize that either, Python always gets this praise for "its so readable!" but it's literally just Perl syntax without all the $
This. Perl can be fast if you are smart. My first Perl scripts were slow but you get smarter with Perl. Perl 5.24 is the fastest yet apparently.

Also hashes are way better than dicts in my opinion.

push @{$hash{$key1}{$key2}{$key3}}, $var;
foreach my $k1 (sort keys %hash){
foreach my $k2 (sort keys %{$hash{$k1}}){
foreach my $k3 (sort keys %{$hash{$k1}{$k2}}){
foreach (@{$hash{$k1}{$k2}{$k3}}) {
print "$k1\t$k2\t$k3\t$_\n";
}
}
}
}


Do that in python and sure you can do it with tuples but it's annoying as fuck writing
if myDict.get(key) == None: myDict[key]=[var]
else : myDict[key].append(var)

>ERE, etc are faster than PCRE

gee, no shit?

I repeat:
>Interpreted programmable language
>Slower than ASM hardcoded parser
who would have thought
You can do a LOT more with Perl than you can with awk/grep, and you can do it a lot faster than you can with Ruby or Python.
Awk and grep are highly specialized tools, Perl is an entire language. Of course it's going to be massively slower.

Perl hashes are the goddamn best and I hate the fact every other language relegates them to key value pairs. Being able to take relational pairings 7 levels deep just by chaining key variables is so convenient

>>Interpreted programmable language
>>Slower than ASM hardcoded parser
That has literally nothing to do with this. It's to do with algorithms.
You can implement the algorithms talked about in the article very naively and in a very slow language, and it would still be billions of times faster than perl.
My whole point is that perl regex are not "good". You can do a lot with them, but they are objectively terrible, and it's such a shame that other regex implementations followed their retardation.

I only use perl as a better sed because GNU hasn't added PCRE to sed yet.

they added a bunch of perl shit though, like e so I imagine some '-P' flag will show up eventually.

Nothing, it has it purpose. Perl was never a end all language type of language and Larry even would say that.

Okay, sure. Perl regex algorithms aren't as fast as they could potentially be. But the benefit in that tradeoff is, as you said, you can do a lot more with them.

wrong, awk is turing complete.

what is being tested here is regexp language performance and PCRE is an extremely complex regexp language with a lot of shit most, pre-perl regexp languages didn't have, like lookahead.

also PCRE allows you to even do shit like test for matched parens.

PCRE is fucking retardedly complex. probably too complex in all honesty.

probably better off learning some PEG/EBNF code generator instead of relying on all that PCRE bullshit.

>awk is turing complete
I'm pretty sure if you tried to write any non-expression-related program in awk it would be complete trash
It's a very specialized tool. Very very specialized.

>But the benefit in that tradeoff is, as you said, you can do a lot more with them
No, I don't think that tradeoff is worth it. It's clearly a symptom of people not understanding regex and trying to force them into a siltation that it's not good at.
This can actually open up denial of service opportunities in programs that accept user-defined regexes.

this.

complex regexp is not a good thing and people should seriously learn better parser tools instead of shoe-horining these fucking nightmares into everything.

they work fine for one off things,but for real, a lot of people abuse regexp.

That's fair. I disagree, because being able to manipulate regex returns directly in a program without having to account for a kajillion special cases is really nice.
But that's a fair line of reasoning.

>who would have thought
Do you seriously think that awk is in some way magnitude faster because of WHAT? What is the specific advantage of AWK which Perl cannot get? And do you seriously think that that curve will get more horizontal ever?
Look at the scale faggit: the blue algo is forever increasing number of times (depends on n) faster then red graph. it is not simply X times faster.
>>Slower than ASM hardcoded parser
There is nothing preventing the usage of same parser in Perl.

>There is nothing preventing the usage of same parser in Perl.
By that logic there's nothing preventing every language in use from implementing ASM algorithms for everything

It is not assembler faggit. Any interpreter overhead is constant time factor, not increasing time factor, get over it. Even if you make an x86 emulator using Javascript interpreted wih Python you won't get the same kind of difference.

Big O, faggit.

>I am retarded and cannot read

It was your fantasy about AWK being faster than Perl because of assembler. I do not care about your hopes.

Perl 6

Larry Wall and Co. treating Perl like a hobby project and telling people who depend on it for work to go fuck themselves while they fuck around with Perl 6 and letting Perl 5 languish.

Who knew it wasn't necessary to learn yet another programming language with asinine syntax just to regex?

This sadly

is python and perl the perfect combo if you could only know two languages?

HAPPY BIRTHDAY TO OUR GLORIOUS GODDESS MAKI!! YOU ARE A MIRACLE AND AN INSPIRATION TO A GENERATION! WE LOVE YOU QUEEN OF Sup Forums!!!!

sites.google.com/site/steveyegge2/tour-de-babel

There are "better" languages than Perl — hell, there are lots of them, if you define "better" as "not being insane". Lisp, Smalltalk, Python, gosh, I could probably name 20 or 30 languages that are "better" than Perl, inasmuch as they don't look like that Sperm Whale that exploded in the streets of Taiwan over the summer. Whale guts everywhere, covering cars, motorcycles, pedestrians. That's Perl. It's charming, really.

But Perl has many, many things going for it that, until recently, no other language had, and they compensated for its exo-intestinal qualities. You can make all sorts of useful things out of exploded whale, including perfume. It's quite useful. And so is Perl.

While all those other languages (Lisp and Smalltalk being particularly noteworthy offenders) tried to pretend that operating systems don't exist, and that lists (for Lisp) or objects (for Smalltalk) are the be-all, end-all of getting shit done, Perl did exactly the opposite. Larry said: Unix and string processing are the be-all, end-all of getting shit done.

And for many tasks, he was absolutely right. So Perl is better at Unix integration and string processing than any language on the planet, save one, and that one only arrived on the scene recently, from the land of Godzilla. I'll get to that one later.

Sadly, Larry focused sooooo hard on Unix integration and string processing that he totally forgot about lists and objects until it was far too late to implement them properly. In fact, a few key mistakes he made early on in Perl's... well, I hesitate to use the word "design" for whale guts, but let's call it Perl's "lifecycle" — those mistakes made it so hard to do lists and objects correctly that Perl has evolved into a genuine Rube Goldberg machine, at least if you want to use lists or objects.

Lists and objects are pretty farging important too, Larry!

/cont

/cont

Perl can't do lists because Larry made the tragically stupid decision early on to flatten them automatically. So (1, 2, (3, 4)) magically becomes (1, 2, 3, 4). Not that you ever want it to work this way. But Larry happened to be working on some problem for which it was convenient on that particular day, and Perl's data structures have been pure exploded whale ever since.

Now you can't read a book or tutorial or PowerPoint on Perl without spending at least a third of your time learning about "references", which are Larry's pathetic, broken, Goldbergian fix for his list-flattening insanity. But Perl's marketing is so incredibly good that it makes you feel as if references are the best thing that ever happened to you. You can take a reference to anything! It's fun! Smells good, too!

Perl can't do objects because Larry never reeeeally believed in them. Maybe that's OK; I'm still not quite sure if I believe in them either. But then why did he try adding them? Perl's OO is a halfhearted add-on that never caught on with the Perl community. It's just not as inspired as the string-processing or Unix integration stuff.

And of course, Perl has plenty of other crackpot design features. Take its "contexts", for instance, which are a horrid outgrowth of Larry's comical decision to have N variable namespaces, dereferenced by sigils, which he sort of copied from shell-script. In Perl, every operator, every function, every operation in the language behaves randomly in one of six different ways, depending on the current "context". There are no rules or heuristics governing how a particular operation will behave in a given context. You just have to commit it all to memory.

Need an example? Here's one: accessing a hash in a scalar context gives you a string containing a fraction whose numerator is the number of allocated keys, and the denominator is the number of buckets. Whale guts, I'm telling you.

Fuck off, Maki's a slut.

it's not fucking exponential, are YOU retarded? it starts off scaling pretty fast, but as far as we can tell from the graph it gets linear after a point

Look at the scale on the y-axis, idiot.

derp

Sasuga Perl programmer

sed 's/\t/ /g'

>Need an example? Here's one: accessing a hash in a scalar context gives you a string containing a fraction whose numerator is the number of allocated keys, and the denominator is the number of buckets. Whale guts, I'm telling you.
What the flying fuck

fpbp

and also Damn, those are sweet, edgy warning examples. They should have called the language "Wismuth" and the packages "Edges".

Nothing.

Perl is pretty old and was a great hacking language for a long time and influenced many langauges. Even today Perl is still a nice language.


Yes, a lot of Perl guys decided to change to Ruby (or Python) in the past. I enjoy Ruby a lot, even though I have more respect for Perl monks. Probably because Ruby on Rails attracted a lot of "just werks" people..
But there are also some 1337 Rubyists, i.e. the Metasploit people got the potential of the language.

Overall Ruby is just a pretty good designed language an not as messy as Perl.


>MTOWTDI is a horrible fucking philosophy and is why 98% of perl code is write-only.

It's called "TIM TOWTDI".
Also Ruby also has this approach and it's not messy. So that can't be the reason. To be honest, even Python has it (they will deny it, but since Python3 you have a lot of options for many things.. which is a good thing).


> They took WAY TOO FUCKING LONG on getting the Perl6 spec out.

Yes, that's what you get for "design by comitee". It's just not a good way to get things done.


>When Perl6 was finalized, it's not even goddamn backwards compatible. You couldn't fuck that up harder if you actively tried.

This. They made the same damn mistakes the Python community did.


> The syntax is ugly as shit and there's too much emphasis on special variables like $_ and $"

In the eye of the beholder.
You can write super clean and elegant code with Perl. But Perl encourages dirty hacks, because people using perl LIKE dirty hacks.


Compare Go vs. Perl:
Go doesn't even uses proper Exceptions, you do a "if err != nil" check. Absolute control, but boring and a lot of boilerplate.

In Perl you have things like "use autodie;". Less NO control and it changes the language behaviour itself. Go people would freak out about it. But it's also pretty cool, because sometimes you don't want to get bothered by boring error cleanup. Just take care of it, programm, will ya?

It's a unique philosophy.

>They made the same damn mistakes the Python community did.
Yet Python seems to be a more successful language now.

Oh no, it's you again..

I've seen you getting rekt because of that stupid image a lot of times, but you keep on coming back. Bascially your graph only applies for really wierd edge cases, also you don't get how important a RegEx is to get things done.

Get off my board..


> I hate the fact every other language relegates them to key value pairs

Try Ruby:
a = {"Hey" => 1, "there" => 2}
b = {"an array" => [1,2,3], 2 => {"is hope" => a}}

p b[a["there"]]["is hope"]

Postmodernism

Oh well..
There was a time Perl scripts ran on many servers.

Python was originally meant as replacement for Bash, but then it got adopted by Universities and branded as the "Language for non-programmers", i.e. scientists.

Python is not a bad language. Personally I prefer Ruby, but Python is also pretty nice in it's own way.

It's difficult to compare those three. I'd say Perl is Python's and Ruby's daddy. Or you could say..

Perl:
Lot of fun, but "great power + great responibility" package. The C++ of the Scripting languages.

Python:
No fun allowed, but Python code is always easy to read. The Java of Scripting langauges.

Ruby:
Somehow a middle ground, you can do a lot of the "Perl shenannigans", but you don't produce unreadable code unless you're really really trying to. The C# (or Rust?) of Scripting languages.