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
Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

yaoi prophet posted:

scalar %a is number of buckets in use/total available buckets, %a = (1..10) creates a hash mapping 1 to 2, 3 to 4, etc

oh that's NOT useful -boart

Adbot
ADBOT LOVES YOU

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

trex eaterofcadrs posted:

imo the hardest part about java is knowing you could do the same poo poo with like 1/5th the typing in like python or ruby (or about a 1:30 ratio in clojure).

oh god typjng is so hard

Shaggar
Apr 26, 2006

ahhh spiders posted:

java is super easy. java ftw

Shaggar
Apr 26, 2006

trex eaterofcadrs posted:

imo the hardest part about java is knowing you could do the same poo poo with like 1/5th the typing in like python or ruby (or about a 1:30 ratio in clojure).

lol

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

rotor posted:

oh god typjng is so hard

Tiny Bug Child
Sep 11, 2004

Avoid Symmetry, Allow Complexity, Introduce Terror
java is actually a p good language if you have to make a desktop "application". and it's kind of cool how java had the idea to make applications you could run on a lot of different platforms before web applications became a thing and you could do that for real

Stringent
Dec 22, 2004


image text goes here

Tiny Bug Child posted:

java is actually a p good language if you have to make a desktop "application". and it's kind of cool how java had the idea to make applications you could run on a lot of different platforms before web applications became a thing and you could do that for real

heyooo

Gazpacho
Jun 18, 2004

by Fluffdaddy
Slippery Tilde

Tiny Bug Child posted:

desktop "application"
t:mad:

double sulk
Jul 2, 2010

Tiny Bug Child posted:

java is actually a p good language if you have to make a desktop "application". and it's kind of cool how java had the idea to make applications you could run on a lot of different platforms before web applications became a thing and you could do that for real

lol

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

Tiny Bug Child posted:

java is actually a p good language if you have to make a desktop "application". and it's kind of cool how java had the idea to make applications you could run on a lot of different platforms before web applications became a thing and you could do that for real

smells like desperation

het
Nov 14, 2002

A dark black past
is my most valued
possession

tef posted:

um, perl is call by reference. python and ruby are call by object (i.e call by value where the value is a reference).

in perl you can write a subroutine called swap, and do swap($a,$b)
I may be a total moron here but like 99% of the time I write a perl sub it goes
code:
sub blah {
  my ($localvar1, $localvar2, @otherlocalvars) = @_; 

  .
  .
  .
}
Unless the sub is like 2 lines long, I'm never actually using @_, I'm copying the values of the parameters to the sub into my local (not perl "local" obv) variables, right?

I definitely understand the distinction being made and that any perl programmer should be aware of it but I thought in practice the pass-by-reference was nullified by that.

homercles
Feb 14, 2010

There have been 8192 posts made by het, an average of 2.35 posts per day, since registering on Nov 15, 2002. het claims to be a porpoise.


happy 213th post het

unleash the unicorn
Dec 23, 2004

If this boat were sinking, I'd give my life to save you. Only because I like you, for reasons and standards of my own. But I couldn't and wouldn't live for you.

Tiny Bug Child posted:

java is actually a p good language if you have to make a desktop "application". and it's kind of cool how java had the idea to make applications you could run on a lot of different platforms before web applications became a thing and you could do that for real
and the best part is that nobody is going to use your "application" because they'll all be like "JVM required? Aww hell nah, not another slow buggy piece of Java poo poo!"

Uninstalling Java and never bothering with Java programs was one of the best computing decicions I ever made. Let's not even start with the "Java needs an update" nightmare.

gangnam reference
Dec 26, 2010

shut up idiot shut up idiot shut up idiot shut up idiot

unleash the unicorn posted:

and the best part is that nobody is going to use your "application" because they'll all be like "JVM required? Aww hell nah, not another slow buggy piece of Java poo poo!"

Uninstalling Java and never bothering with Java programs was one of the best computing decicions I ever made. Let's not even start with the "Java needs an update" nightmare.

yo good poo poo *hi-5* do you boycott microsoft too cause its a really cool thing to do and i think we should be friends

wait are you whining about occasional program updates
really?

unleash the unicorn
Dec 23, 2004

If this boat were sinking, I'd give my life to save you. Only because I like you, for reasons and standards of my own. But I couldn't and wouldn't live for you.

Gogey posted:

wait are you whining about occasional program updates
really?
Nevermind that I said "lets not even get into that", but in tyool 2012? Yes I am.

Chrome can do it without bothering me, time for Java to catch up.

And let's just be honest here: idk about server side applications but name one desktop application written in Java that's not complete poo poo.

Nomnom Cookie
Aug 30, 2009



intellij idea

het
Nov 14, 2002

A dark black past
is my most valued
possession

homercles posted:

There have been 8192 posts made by het, an average of 2.35 posts per day, since registering on Nov 15, 2002. het claims to be a porpoise.


happy 213th post het
lol, thanks :)

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

unleash the unicorn posted:

Nevermind that I said "lets not even get into that", but in tyool 2012? Yes I am.

Chrome can do it without bothering me, time for Java to catch up.

And let's just be honest here: idk about server side applications but name one desktop application written in Java that's not complete poo poo.

intellij idea

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Nomnom Cookie posted:

intellij idea

oh hi

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome
you don't really notice java apps anymore because the deployment has gotten easier and native l&f is good for the bulk of the widget and thank GOD people stopped loving naming their loving apps jWhatever

gangnam reference
Dec 26, 2010

shut up idiot shut up idiot shut up idiot shut up idiot

rotor posted:

you don't really notice java apps anymore because the deployment has gotten easier and native l&f is good for the bulk of the widget and thank GOD people stopped loving naming their loving apps jWhatever

yeah this

unleash the unicorn
Dec 23, 2004

If this boat were sinking, I'd give my life to save you. Only because I like you, for reasons and standards of my own. But I couldn't and wouldn't live for you.

rotor posted:

intellij idea

That's just so developers will inflict that poo poo on more end-users

Also lol because that really does seem to be the only one considering that's what both of you jumped to immediately.

unleash the unicorn fucked around with this message at 07:39 on May 28, 2012

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

unleash the unicorn posted:

That's just so developers will inflict that poo poo on more end-users

your hatred only makes me stronger

homercles
Feb 14, 2010

unleash the unicorn posted:

And let's just be honest here: idk about server side applications but name one desktop application written in Java that's not complete poo poo.
0x10c

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

notch loving sucks

gangnam reference
Dec 26, 2010

shut up idiot shut up idiot shut up idiot shut up idiot

unleash the unicorn posted:

Also lol because that really does seem to be the only one considering that's what both of you jumped to immediately.

that's cause I don't think "hmm, is this java this ebtter not be java" when i start a program so I don't associate things with it. I can't think of many things i use that are java applications but that doesn't necessarily mean it's horrible like you think it is!!

tef
May 30, 2004

-> some l-system crap ->

het posted:

Unless the sub is like 2 lines long, I'm never actually using @_, I'm copying the values of the parameters to the sub into my local (not perl "local" obv) variables, right?

if you copy @_ it's all as expected. if you assign to @_ then magic happens :q:

unleash the unicorn
Dec 23, 2004

If this boat were sinking, I'd give my life to save you. Only because I like you, for reasons and standards of my own. But I couldn't and wouldn't live for you.

Gogey posted:

that's cause I don't think "hmm, is this java this ebtter not be java" when i start a program so I don't associate things with it. I can't think of many things i use that are java applications but that doesn't necessarily mean it's horrible like you think it is!!

Let me help you out:

Does it take forever to start up? It's probably a Java!

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

unleash the unicorn posted:

Let me help you out:

Does it take forever to start up? It's probably a Java!

wow, adobe musta ported all their poo poo to java while I wasn't lookin

het
Nov 14, 2002

A dark black past
is my most valued
possession

tef posted:

if you copy @_ it's all as expected. if you assign to @_ then magic happens :q:
Oh sure. I mean perl best practices are to copy @_ for exactly that reason though right? This barely ever applies in not-horrible perl code (and fair enough pointing out that there's lots of awful perl code written), and anything more complex than one array of scalars is going to be explicitly passed by reference so everyone knows what's going on anyway.

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>

rotor posted:

wow, adobe musta ported all their poo poo to java while I wasn't lookin

TiMBuS
Sep 25, 2007

LOL WUT?

Rufo posted:

2. perl passes everything by value (when youre passing a reference youre still just passing a scalar by value)

id actually say #2 is a positive thing. you dont have to think wtf is happening when you call a subroutine. you know its all by value.

perl6 made everything a reference. i hope this doesnt make u too mad.
but this means:
Perl code:
my @arr = 1,2,3,4,5;
my $arr-ref = @arr;
say $arr-ref[2] == @arr[2]; # True
Note the sigils dont change, theres no->arrows, (brackets) around the list arent needed, boolean types. these r all neato changes.


Also arrays are passed by ref, so they arent flattened as you previously said:
Perl code:
sub head(@z) {
    return @z[0];
}
my @array = 1..Inf;

say head(@array);
prints "1" b/c the array isnt flattened (if it was flattened youd lose your heap).


but not just arrays/hashes. even scalars are refs. when passed to functions they are (by default) readonly refs.
Perl code:
sub add-one-readonly ($z) {
    $z = $z+1; #Error. cannot modify readonly value
}


sub add-one-ref ($z is rw) {
    $z = $z+1; #Cool.
}
my $a = 0;
add-one-ref ($a)
say $a; #It's now 1.

add-one-ref(5); #But this will fail.


#If you prefer the Old Way
sub add-one-perl5 ($z is copy) {
    $z = $z+1; 
}
Good poo poo! go get perl 6!!

TiMBuS
Sep 25, 2007

LOL WUT?

tef posted:

if you copy @_ it's all as expected. if you assign to @_ then magic happens :q:

please no

NeoHentaiMaster
Jul 13, 2004
More well adjusted then you'd think.
You pass two arrays to a perl function no problem !

code:
sub protest (\@\@) {
    my ($one, $two) = @_ ;
    printf "Array one has %i elements. Array two has %i", scalar @$one, scalar @$two;
};
But don't do this because no one can be bothered to learn the difference between traditional type signatures and perls prototypes that just do type coercion. Well, that and it does weird things sometimes.

NeoHentaiMaster fucked around with this message at 11:09 on May 28, 2012

Rufus Ping
Dec 27, 2006





I'm a Friend of Rodney Nano

tef posted:

um, perl is call by reference. python and ruby are call by object (i.e call by value where the value is a reference).

in perl you can write a subroutine called swap, and do swap($a,$b)

gotcha

tef posted:

whoever told you this has no loving idea what they are talking about.

slightly surprised but entirely possible

tef posted:

it turns out that passing a reference to an immutable value is almost indistinguishable from passing that value.

hrm yeah

tef posted:

what are they teaching you rufo :smith:

this is a personal failing not one of my alma mater

TiMBuS
Sep 25, 2007

LOL WUT?

NeoHentaiMaster posted:

You pass two arrays to a perl function no problem !

code:
sub protest (\@\@) {
    my ($one, $two) = @_ ;
    printf "Array one has %i elements. Array two has %i", scalar @$one, scalar @$two;
};
But don't do this because no one can be bothered to learn the difference between traditional type signatures and perls prototypes that just do type coercion. Well, that and it does weird sometimes.
yeah thats a perl 5 wart.

perl6:
Perl code:
sub protest (@one, @two) {
    say "Array one has {@one.elems} elements. Array two has {@two.elems}";
}

Rufus Ping
Dec 27, 2006





I'm a Friend of Rodney Nano

TiMBuS posted:

Good poo poo! go get perl 6!!

damnit timbus

TiMBuS
Sep 25, 2007

LOL WUT?

Stringent
Dec 22, 2004


image text goes here

TiMBuS posted:

but not just arrays/hashes. even scalars are refs. when passed to functions they are (by default) readonly refs.
Perl code:
sub add-one-readonly ($z) {
    $z = $z+1; #Error. cannot modify readonly value
}


sub add-one-ref ($z is rw) {
    $z = $z+1; #Cool.
}
my $a = 0;
add-one-ref ($a)
say $a; #It's now 1.

add-one-ref(5); #But this will fail.


#If you prefer the Old Way
sub add-one-perl5 ($z is copy) {
    $z = $z+1; 
}
Good poo poo! go get perl 6!!

:ughh:

Adbot
ADBOT LOVES YOU

TiMBuS
Sep 25, 2007

LOL WUT?

pff yea epic facepalm, code that avoids unneeded copying and also avoids actoin-at-a-distance ref fuckery is totally a bad idea.

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