Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

perl has no function arg list

Name: Anonymous 2012-12-20 5:11

Im learning a little perl and everything about perl is done in the worst and most convoluted way. Prime example being that function definitions dont have an argument list but rather an implicit list that is extracted from within the function by @_.
Why is there no explicitly declared parameter list. I got banned from #perl on freenode for asking this.

Name: Anonymous 2012-12-20 5:18

They probably got thiat a lot and probably trolled for it as well. Not your fault Perl is such a retarded language only a fulltime autist can create.

Name: Anonymous 2012-12-20 16:25

Can you please explain how argument lists extracted from @_ is the worst and most convoluted way of doing this?

Seems simple and effective to me.

Name: Anonymous 2012-12-20 18:02

i'm no fan of perl, but for a scripting language i don't see anything wrong at the way parameters are fetched in perl. is just different.

Name: Anonymous 2012-12-20 18:05

Perl sort of inherited this from shell scripts, which are way worse because everything is stringly typed (note spelling) and you constantly have to shuffle things in and out of godforsaken space-delimited lists. At least Perl lets you distinguish between text and data structures.

Perl 6 finally does away with the implicit list thing, so if you're looking for a version of Perl that's INTELLIGENTLY DESIGNED, that will be your jam.

Name: Anonymous 2012-12-20 18:08

You fagshits. No one uses Perl anymore now that Javascript has made it obsolete, cretins!

Name: Anonymous 2012-12-20 18:13

perl is used a lot in heavy-duty environments for what i've see in my experience (banks, communications), is not a hipster tool. I agree that is in decline. but also CPAN is not that big for nothing.

Name: Anonymous 2012-12-20 20:31

>>3
Can you please explain how argument lists extracted from @_ is the worst and most convoluted way of doing this? Seems simple and effective to me.
how would you look up function definitions for perl? you have to read through the code of the function to find what to pass to it. why cant there just be argument lists so you know at a glance what functions take so you know how to extend a script?

>>5
At least Perl lets you distinguish between text and data structures.
which is the second most stupid thing about perl, you cant have nested structures in perl because the variable type says it can only be data or a structure, so you have to use those stupid references to be able to create a nested structure. this also makes declarations more complicated and you have to declare arrays or hashes as a sequence, it takes special syntax to declare an explicit array or hash

Name: Anonymous 2012-12-20 21:02

>>8
What about Ctrl+F and looking for "sub myfunction"? or using a source code browser like vim.taglist or just a simple Windows text-editor like PSPAD with integrated source-code browsing?

Personally, i love those weird variable argument lists. i prefer to have this kind of "overloading" instead of separate functions just because of the different arities. If you really want to know how to extend a function, document it instead on just relying on the signature and argument names! Many editors understands comment lines just before the functions definitions and use them as the "help" for that function. Even better, you should use POD!

Also references are only a variable name with a "\" at the start, is not that complicated. What's worse is the 'container casting' required when, for example, you want to have a hash of arrays. And is not that bad either. Is still simple and straightforward.


#!perl
use strict;
use Data::Dumper;
my @e = (1, 3);
my @o = (2, 4);
my %hash;
push @{ $hash{'even'} }, @e;
push @{ $hash{'odds'} }, @o;
print Dumper %hash;


I think you are asking too much for a scripting language designed for system-mantaining tasks and text processing. Even so, many people have done amazing and usable things with perl.

Name: Anonymous 2012-12-21 4:15

>>8
how would you look up function definitions for perl?
By pressing ^] like a normal person. The problem with signatures is they were designed poorly and Perl 5 is stuck with that. I am a little surprised there are no packages to fix that and do automatic binding, but it's NBD.

you cant have nested structures in perl because
Like most dynamic languages you end up using refs to create complex structures. You see it more in Perl than the others, but using refs isn't hard, and you can still take slices easily.

Perl 6 allows you to define the data representation, giving you compact storage.

Name: Anonymous 2012-12-21 5:30

Like most dynamic languages you end up using refs to create complex structures.
no, perl is the only scripting language I know of that forces you to have to use indirection to access variables

Name: Anonymous 2012-12-21 6:55

Even PHP is better than Perl. Yuck. Today, Perl simply has no niche to fill.

Name: Anonymous 2012-12-21 8:02

Perl is the C++ of scripting languages.

Name: Anonymous 2012-12-21 11:58

>>13
sure is the c++ of the scripting languages, but is the abelson of the scripting languages?

Name: Anonymous 2012-12-21 12:22

>>11
You don't know much about how languages are implemented then. You might not explicitly create the refs yourself, but they're there in a lot of languages, even C# and Java have this problem.

Name: Anonymous 2012-12-21 12:51

>>15
In Java, the JVM pushes and pops a stack to pass parameters to a method. You, however, are oblivious to this fact because Java's designers weren't so impossibly retarded as to force you to operate this stack explicitly.

I don't give a fuck if the VM uses this or that construct to implement a feature, that's their design choice and it's no excuse to make the programmer pay it with accidental complexity.

Name: Anonymous 2012-12-21 13:25

>>16
I was talking about structures, not argument passing.

Name: 17 2012-12-21 13:28

>>16
Also, the needless indirection impacts performance. Not just memory use, but also memory reclamation: https://sebastiansylvan.wordpress.com/2012/12/01/garbage-collection-thoughts/

But you wouldn't care about that.

Name: Anonymous 2012-12-21 14:23

>>17
If you post in this thread you have to address both, or your argument is wrong.

Name: Anonymous 2012-12-21 20:39

>>19
No, that's not true.

Name: Anonymous 2012-12-21 23:01

eye am teh storngest. eye ahev a dress and eye freeze w/ my danmaku. If you don't repost this to ⑨ other people eye will fly into your pond tonight and make a mess of your frogs

Don't change these.
Name: Email:
Entire Thread Thread List