Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Suspicious Dish
Sep 24, 2011

2020 is the year of linux on the desktop, bro
Fun Shoe
you have to remember it's perl programmers writing this. did you expect anything else?

Adbot
ADBOT LOVES YOU

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Jewel posted:

Perl 6 is a nightmare :shittypop: :shittypop: :shittypop:

I feel like Perl would benefit from having a gatekeeper in the way of all changes who just asks "what problem does this solve".

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

Hammerite posted:

I feel like Perl would benefit from having a gatekeeper in the way of all changes who just asks "what problem does this solve".

Remember that the Perl motto is "there's more than one way to do it", so the "problem" being solved in many cases would be "there's currently an insufficient number of ways to do this thing."

Kilson
Jan 16, 2003

I EAT LITTLE CHILDREN FOR BREAKFAST !!11!!1!!!!111!

Hammerite posted:

I feel like Perl all software would benefit from having a gatekeeper in the way of all changes who just asks "what problem does this solve".

Fixed

fritz
Jul 26, 2003

Hammerite posted:

I feel like Perl would benefit from having a gatekeeper in the way of all changes who just asks "what problem does this solve".

That's about as anti-perl an idea as it's possible to be.

Spatial
Nov 15, 2007

So much forehead slapping

Harik
Sep 9, 2001

From the hard streets of Moscow
First dog to touch the stars


Plaster Town Cop

Spatial posted:

So much forehead slapping

A brave new world of unicode parsing vulnerabilities. I'm honestly glad that I used php instead of perl for late 90s CGI work. As poo poo as it is it didn't train you that clever > *.

Reading perl reminds me of Sendmail's turing complete configuration language

code:
#######################################################################
#			Sendmail as a Turing machine
#
# Representing TM's tape:
# Cells are separated by a . character (a single dot)
# '@' sign means a blank character.
# % specifies the current position of the head.
# For example,
# 	@.I.I.%I
# stands for a tape that starts with a blank and contains three I
# characters. The TM head is over the last 'I' character.
#	ab.cde.%@
# shows a tape with two non-blank symbols. The head is positioned after
# the second one.

# Move the head to the left
Smove_left
R$* @ . %		$@ $1 % @
R$* $- . % @		$@ $1 % $2
R$* $- . % $*		$@ $1 % $2 . $3
R$*			$#error underflow: $1

# Move the head to the right
Smove_right
R$* % $- . $+		$@ $1 $2 . % $3
R$* % $-		$@ $1 $2 . %@	there is always a blank at the right
R$* %			$@ $1 @ . %@	edge of the tape
R$*			$#error no-head: $1

 Addition function
# @.a.a.a.@.a.a.%@
Sadd
R$+. %			$: $1.%@
R$+. %@ $*		$: $>move_left $1.%@$2
R$+. %a $*		$>move_left $1.%a$2	until the first blank
R$+. %@ $*		$: $>move_right $1.%a$2	replace blank with 'a'
R$+. %a $*		$>move_right $1.%a$2	until the first blank
R$+. %@ $*		$: $>move_left $1.%@$2
R$+. %$- $*		$@ $1.%@$3		overwrite $2 with a blank

fritz
Jul 26, 2003

Do people still use sendmail? Seems like time was you would hear about a sendmail vulnerability every month.

Doom Mathematic
Sep 2, 2008

Nippashish posted:

I'm pretty sure Perl is entirely designed around being maximally clever.

The purpose of calling ASCII operators "Texas" is so that when a Perl 6 programmer calls ASCII operators "Texas", somebody else has no choice but to ask why they call ASCII operators "Texas", which leads naturally into a delightful and exasperating conversation about Perl 6. It has nothing to do with overarching language design or consistency, it's intended to trap people for the purposes of evangelism. It's the same with any cutesy feature of Perl 5 or Perl 6. It's the most maddening way to design a programming language I've ever seen.

Perl 6 Booleans have a successor method which always returns True. Perl 6 has five equality operators: eqv, ==, eq, ===, =:=. Perl 6 has a role Stringy for anything which can act like a string, Str, Uni, Blob, which apparently does nothing. It has a concept Cool which, despite being an adjective, is not a role but a class; "Cool" actually stands for "convenient object-oriented loop". Again, it is not a role, nor is it a programming construct, certainly not a loop; it's a class. "Perl 6 intentionally confuses items and single-element lists", which means that, whereas in Perl 5 any value could be used alternately as a string or a number and it was largely impossible to distinguish the two, in Perl 6 any value can be used alternately as a string, a number or a list. And a string, of course, when considered as a list, always has length 1.

This is everything I know about Perl 6.

Doom Mathematic
Sep 2, 2008
Oh, almost forgot: it's not "loop", it's actually loopback.

Yeah, like the network address. Intentionally.

lifg
Dec 4, 2000
<this tag left blank>
Muldoon
If it helps, and it won't, remember that Perl was designed by a linguist to be as expressive as a natural human language. It was Perl's first mistake.

Spatial
Nov 15, 2007

When I took Perl in college I knew things were going to take a turn for the worse when I saw the trailing if statements.

Also sigils can pissssssssss

Doom Mathematic
Sep 2, 2008
Perl code:
print reverse "hello"; # "hello"

my $string = reverse "hello";
print $string; # "olleh"

Harik
Sep 9, 2001

From the hard streets of Moscow
First dog to touch the stars


Plaster Town Cop

fritz posted:

Do people still use sendmail? Seems like time was you would hear about a sendmail vulnerability every month.

God, I hope not. There's so many better options. They just don't have the distinction of such an... interesting configuration format.

E: I have a pocketknife with the sendmail logo that I got from Eric Allman at some linux conference. That'd be sometime after '98 when he formed Sendmail, inc and still had control of it. Back then, being a "swiss army knife" program was considered a good thing instead of a morass of security vulnerabilities that we look at it as now.

Harik fucked around with this message at 01:11 on Aug 11, 2017

vOv
Feb 8, 2014

Doom Mathematic posted:

Perl code:
print reverse "hello"; # "hello"

my $string = reverse "hello";
print $string; # "olleh"

Ooh, I know this one! It's because `print` evaluates its arguments in list context, and in list context `reverse` just returns its arguments but in the opposite order. Since it only has one argument, it just returns it. But if you do `$string = reverse "hello"` then reverse is being called in a scalar context, in which case it does string reversal.

Kilson
Jan 16, 2003

I EAT LITTLE CHILDREN FOR BREAKFAST !!11!!1!!!!111!

vOv posted:

Ooh, I know this one! It's because `print` evaluates its arguments in list context, and in list context `reverse` just returns its arguments but in the opposite order. Since it only has one argument, it just returns it. But if you do `$string = reverse "hello"` then reverse is being called in a scalar context, in which case it does string reversal.

:psypop:

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

vOv posted:

Ooh, I know this one! It's because `print` evaluates its arguments in list context, and in list context `reverse` just returns its arguments but in the opposite order. Since it only has one argument, it just returns it. But if you do `$string = reverse "hello"` then reverse is being called in a scalar context, in which case it does string reversal.

Can’t decide what’s worse: that the above is what happens, or that I correctly guessed the explanation before reading it.

WINNINGHARD
Oct 4, 2014

Is there something perl 6 is particularly well-suited for?

e: other than one-liners to replace some annoying bash stuff, is there anything perl 5 is well-suited for?

ynohtna
Feb 16, 2007

backwoods compatible
Illegal Hen
Job security.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
If you're the sort of person who wants to make a programming language, and you also like programming lots of nifty special cases and writing lots of cutesy documentation explaining them with jokes and metaphors, perl 6 is pretty fantastic.

I have no idea why anyone would actually want to use it.

fritz
Jul 26, 2003

WINNINGHARD posted:

Is there something perl 6 is particularly well-suited for?

e: other than one-liners to replace some annoying bash stuff, is there anything perl 5 is well-suited for?

Replacing sed and awk.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Spatial posted:

When I took Perl in college I knew things were going to take a turn for the worse when I saw the trailing if statements.

Also sigils can pissssssssss

Trailing if statements? I'm somewhat familiar with Perl but I'm not sure how that'd work

ExcessBLarg!
Sep 1, 2001

WINNINGHARD posted:

Is there something perl 6 is particularly well-suited for?
It's existence puts Ruby squarely in the "sane language" category, which helps since I've long used Ruby for things I used to use Perl 5 for in the past.

fritz
Jul 26, 2003

Munkeymon posted:

Trailing if statements? I'm somewhat familiar with Perl but I'm not sure how that'd work

print "that's perl everybody" if $a==$b;

Eela6
May 25, 2007
Shredded Hen
That does seem ugly. How do you all feel about Python's trailing conditional assignment?

Python code:
dessert = 'ice cream' if day in {'saturday', 'sunday'} else 'cookies'

ExcessBLarg!
Sep 1, 2001

Munkeymon posted:

Trailing if statements? I'm somewhat familiar with Perl but I'm not sure how that'd work
They're useful if you're doing a bunch of the same operation (e.g., printing a list of things) but some of them are optional. Like:
code:
print "Record foo: $foo\n";
print "Record bar: $bar\n";
print "Optional record baz: $baz\n" if defined $baz;
print "Record quux: $quux\n";

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe
Perl also has the `unless` conditional so you can do e.g. "i++ unless i % 2".

I'm kind of amused that Perl has an entire separate keyword for saying "if not", but on the other hand it does read rather prettily.

PT6A
Jan 5, 2006

Public school teachers are callous dictators who won't lift a finger to stop children from peeing in my plane

Eela6 posted:

That does seem ugly. How do you all feel about Python's trailing conditional assignment?

Python code:
dessert = 'ice cream' if day in {'saturday', 'sunday'} else 'cookies'

It can be useful if it's not overused. I think it represents a more readable way of accomplishing the same thing as the ternary operator.

ChaosArgate
Oct 10, 2012

Why does everyone think I'm going to get in trouble?

PT6A posted:

It can be useful if it's not overused. I think it represents a more readable way of accomplishing the same thing as the ternary operator.

That's because it is Python's ternary operator. :v:

Doom Mathematic
Sep 2, 2008

TooMuchAbstraction posted:

Perl also has the `unless` conditional so you can do e.g. "i++ unless i % 2".

I'm kind of amused that Perl has an entire separate keyword for saying "if not", but on the other hand it does read rather prettily.

Plus it lets you do confusing triple negatives, like this!

Perl code:
unless ($noCookies != 0) {
  print "there were no cookies";
} else {
  print "wait, what";
}

Doom Mathematic
Sep 2, 2008

fritz posted:

print "that's perl everybody" if $a==$b;

Careful: $a and $b are reserved globals! They're used for sorting, and changing them causes sorting to break.

Perl code:
my $a = "C"; # no error or warning, though

print sort { $a cmp $b } qw(A C E G B D F H);
# prints "BACFEDGH" or similar

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



fritz posted:

print "that's perl everybody" if $a==$b;

Oh :doh: my brain shut down after the 'if' in 'trailing if statement' and I couldn't figure out how ending a whole expression in an if keyword (not whole statement) was possible in Perl syntax, but would not be surprised if it were because Perl.

Bongo Bill
Jan 17, 2012

Ruby can do that too.

necrotic
Aug 2, 2005
I owe my brother big time for this!

Doom Mathematic posted:

Plus it lets you do confusing triple negatives, like this!

Perl code:
unless ($noCookies != 0) {
  print "there were no cookies";
} else {
  print "wait, what";
}

I go on a rampage whenever I see poo poo like this. How broke does your brain have to be to think this is okay?

Fergus Mac Roich
Nov 5, 2008

Soiled Meat
Is noCookies an integer containing the number of cookies, or a boolean telling you if there are cookies?

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

Fergus Mac Roich posted:

Is noCookies an integer containing the number of cookies, or a boolean telling you if there are cookies?

Yes.

JawnV6
Jul 4, 2004

So hot ...

PT6A posted:

It can be useful if it's not overused. I think it represents a more readable way of accomplishing the same thing as the ternary operator.

But it splits up the possible assignables and jams the condition in the middle? The ternary is a gussied up if/then/else.

lifg
Dec 4, 2000
<this tag left blank>
Muldoon

necrotic posted:

I go on a rampage whenever I see poo poo like this. How broke does your brain have to be to think this is okay?

I can tell you exactly how it happens, because I've seen it happen. It's a series of well meaning steps. First it's a simple "unless", then a bug fix changes it to an "unless not equals", then a new feature changes it to "unless not equals or else".

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe

JawnV6 posted:

But it splits up the possible assignables and jams the condition in the middle? The ternary is a gussied up if/then/else.

I do like the order of operations in the ternary operator better, but I hate using "?" and ":" as control flow indicators; keywords are definitely preferable.

I guess Python doesn't allow "foo = if bar then baz else quux" because it doesn't read nicely?

Adbot
ADBOT LOVES YOU

necrotic
Aug 2, 2005
I owe my brother big time for this!

lifg posted:

I can tell you exactly how it happens, because I've seen it happen. It's a series of well meaning steps. First it's a simple "unless", then a bug fix changes it to an "unless not equals", then a new feature changes it to "unless not equals or else".

I know how it happens, but not someone does the third change and goes "gently caress that". I've all but banned the use of unless in our code base except in basic guard conditions. Affirmatives or GTFO.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply