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
rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Internaut! posted:

where does as3 fall on the verbosity scale

iirc it looked a lot like java

its ecmascript

Adbot
ADBOT LOVES YOU

duTrieux.
Oct 9, 2003

rotor posted:

                                                                     its ecmascript
                                                                           /

EMILY BLUNTS
Jan 1, 2005


i think i saw a porno like that once

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

man I wish. that trench owns.

skeevy achievements
Feb 25, 2008

by merry exmarx

ahhh spiders posted:

. . . seriously?

yes I'm seriously asking rotor if he feels as3 is verbose or not by his standards but please make a few more zero content posts about it

vapid cutlery
Apr 17, 2007

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

Internaut! posted:

yes I'm seriously asking rotor if he feels as3 is verbose or not by his standards but please make a few more zero content posts about it

your question makes no sense

vapid cutlery
Apr 17, 2007

php:
<?
"it's george costanza" ?>
i mean, if you had actually read the post explaining it, you would have understood but as usual you've cherrypicked something that allows you to be dismissive and abrasive :thumbsup:

tef
May 30, 2004

-> some l-system crap ->

ahhh spiders posted:

you've cherrypicked something that allows you to be dismissive and abrasive :thumbsup:

and that is my gimmick :stare:

EMILY BLUNTS
Jan 1, 2005

its the tech support survival defense
"maybe if im a big enough rear end in a top hat people will just google it instead of calling me"

vapid cutlery
Apr 17, 2007

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

Resplendent Spiral posted:

its the tech support survival defense
"maybe if im a big enough rear end in a top hat people will just google it instead of calling me"

that explains everything about him then

jony neuemonic
Nov 13, 2009

Resplendent Spiral posted:

its the tech support survival defense
"maybe if im a big enough rear end in a top hat people will just google it instead of calling me"

please tell me this works

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

Internaut! posted:

yes I'm seriously asking rotor if he feels as3 is verbose or not by his standards but please make a few more zero content posts about it

its about medium I guess

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

rotor posted:

why? what problem does highly meaning-dense code solve?

there was that one study once that basically said you can write the same number of lines of code per day and make the same amount of fuckups per line of code no matter whether it's as vacuous as asm or as dense as apl

so the obvious answer to reduce the number of lines of code that have to be written so you can finish faster and with a lower absolute number of bugs

big_list_of_strings.sort_by(&:length) is less error prone than sorting by strlen is less error prone than sorting by dereferencing pointers to strings and counting the chars before a null terminator without the benefit of c

rotor
Jun 11, 2001

classic case of pineapple derangement syndrome

BonzoESC posted:

there was that one study once that basically said you can write the same number of lines of code per day and make the same amount of fuckups per line of code no matter whether it's as vacuous as asm or as dense as apl

i find that very hard to believe, unless you're talking about syntax poo poo the compiler catches

Zombywuf
Mar 29, 2008

rotor posted:

i find that very hard to believe, unless you're talking about syntax poo poo the compiler catches

I suspect it's the amount of things the programmer has to remember. If sorting a list involves remembering which AbstractSortAlgorithmFactory to use and how to use it, plus remembering the correct way to define their ComparsionVistorFactory then the chance of a gently caress up is much higher.

Shaggar
Apr 26, 2006
thats something completely different though and if you're using java then the class names are descriptive. If you cant figure out what class ur supposed to use for something ur probably an idiot or someone pulled a P Languge on you and hosed up some class names to "save on typing" or something equally retarded.

ex: if you want to order List<Butt> butts by left cheek size you'd use a LeftCheekSizeButtComparator (which implements Comparator<Butt>)

Java code:
Collections.sort(butts, new LeftCheekSizeButtComparator(LeftCheekSizeButtComparator.DESCENDING));

skeevy achievements
Feb 25, 2008

by merry exmarx
yeah I don't see a problem with this, there's zero chance you could misunderstand the meaning of that code, and a good editor would generate 80+% of that line for you anyway giving you "brevity of effort" while eliminating the opportunity for spelling mistakes inherent in descriptive variable/function names

wrap it up etc

0xB16B00B5
Aug 24, 2006

by Y Kant Ozma Post
i fall asleep halfway through reading any objective C method call

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.

Internaut! posted:

yeah I don't see a problem with this, there's zero chance you could misunderstand the meaning of that code, and a good editor would generate 80+% of that line for you anyway giving you "brevity of effort" while eliminating the opportunity for spelling mistakes inherent in descriptive variable/function names

wrap it up etc

well you're looking at one line in isolation, if you have 1000 of those lines it gets mentally tedious to read. also that probably one of the cleanest corners of java and not representative of the language as a whole.

Catalyst-proof
May 11, 2011

better waste some time with you

tinselt0wn posted:

i fall asleep halfway through reading any objective C method call

NSarcolepsy

0xB16B00B5
Aug 24, 2006

by Y Kant Ozma Post

Fren posted:

NSarcolepsy

Zombywuf
Mar 29, 2008

Shaggar posted:

thats something completely different though and if you're using java then the class names are descriptive. If you cant figure out what class ur supposed to use for something ur probably an idiot or someone pulled a P Languge on you and hosed up some class names to "save on typing" or something equally retarded.

ex: if you want to order List<Butt> butts by left cheek size you'd use a LeftCheekSizeButtComparator (which implements Comparator<Butt>)

Java code:
Collections.sort(butts, new LeftCheekSizeButtComparator(LeftCheekSizeButtComparator.DESCENDING));

Yeah, I'll just memorize every class that implements Comparator<>. While of course memorising the Comparator<> interface for when I need to implement my own.

Then I will cut off my own hands.

skeevy achievements
Feb 25, 2008

by merry exmarx
the comparator interface

code:
Method Summary
 int	compare(T o1, T o2) 
          Compares its two arguments for order.
 boolean	equals(Object obj) 
          Indicates whether some other object is "equal to" this comparator.
that's it

Shaggar
Apr 26, 2006

Zombywuf posted:

Yeah, I'll just memorize every class that implements Comparator<>. While of course memorising the Comparator<> interface for when I need to implement my own.

Then I will cut off my own hands.

u dont memorize classes u retaqrd. u memorize concepts (like comparators) and when you need a comparator you look to see if someone in ur project has already written one and if they arent tarded they'll have named it based on what it does. then if no ones created the comparator you want you create ur own (named properly so other people can find it in the future).

i mean its fine if you've never used java and you dont know what a comparator is or what Collections is or how they work, but if ur a java dev that shits like critical (and also braindead ez).

trex eaterofcadrs
Jun 17, 2005
My lack of understanding is only exceeded by my lack of concern.
don't forget all the poo poo you have to boilerplate away there

getting "equals" correct is non-trivial

Zombywuf
Mar 29, 2008

Shaggar posted:

u dont memorize classes u retaqrd. u memorize concepts (like comparators) and when you need a comparator you look to see if someone in ur project has already written one and if they arent tarded they'll have named it based on what it does. then if no ones created the comparator you want you create ur own (named properly so other people can find it in the future).

i mean its fine if you've never used java and you dont know what a comparator is or what Collections is or how they work, but if ur a java dev that shits like critical (and also braindead ez).

code:
sort!("a.butt < b.butt")(some_range);
Perl code:
sort {$a->{butt} <=> $b->{butt}} @some_list;
Python code:
sort(some_list, key=lambda x: x.butt)
Come on Java, this poo poo's not hard.

Shaggar
Apr 26, 2006

Zombywuf posted:

code:
sort!("a.butt < b.butt")(some_range);
Perl code:
sort {$a->{butt} <=> $b->{butt}} @some_list;
Python code:
sort(some_list, key=lambda x: x.butt)
Come on Java, this poo poo's not hard.

lol thats awful

Emacs Headroom
Aug 2, 2003

Shaggar posted:

lol thats awful

how is the orange sky on your planet? do the three moons look nice today?

coaxmetal
Oct 21, 2010

I flamed me own dad

Shaggar posted:

lol thats awful

can you elaborate on exactly why it is awful? tia

Shaggar
Apr 26, 2006
because 1 its ordering on the natural order of butt which isnt the same as a comparator. 2 if you're using a comparator in a bunch of different locations and need to update the logic you do it inside the comparator and you're done. in your shitlanguages you'd have to search and replace for all your compares. 3 the java is far more readable than gross rear end shitlanguages

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Shaggar posted:

because 1 its ordering on the natural order of butt which isnt the same as a comparator. 2 if you're using a comparator in a bunch of different locations and need to update the logic you do it inside the comparator and you're done. in your shitlanguages you'd have to search and replace for all your compares. 3 the java is far more readable than gross rear end shitlanguages

if you're sorting 'em by the same field that much you put a new method on the object to be compared that returns its sort value and sort by that

and a new method in a good language is much simpler than
Java code:
class AgeComparator implements Comparator{
   
    public int compare(Object emp1, Object emp2){
       
        int emp1Age = ((Employee)emp1).getAge();        
        int emp2Age = ((Employee)emp2).getAge();
       
        if(emp1Age > emp2Age)
            return 1;
        else if(emp1Age < emp2Age)
            return -1;
        else
            return 0;    
    }
   
}

Zombywuf
Mar 29, 2008

Shaggar posted:

because 1 its ordering on the natural order of butt which isnt the same as a comparator. 2 if you're using a comparator in a bunch of different locations and need to update the logic you do it inside the comparator and you're done. in your shitlanguages you'd have to search and replace for all your compares. 3 the java is far more readable than gross rear end shitlanguages

1)
Python code:
sort(key=lambda x: x.butt.size)
Happy now?

2) Do you often go around changing the total order's of numbers?

3) At least my examples fit on the screen.

Emacs Headroom
Aug 2, 2003
if your changing what your comparing, you will need to name the new comparator something else, and youll have to find and replace anyway.

shaggargument is specious

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Ridgely_Fan posted:

if your changing what your comparing, you will need to name the new comparator something else, and youll have to find and replace anyway.

shaggargument is specious

shaggled again

coaxmetal
Oct 21, 2010

I flamed me own dad

Shaggar posted:

because 1 its ordering on the natural order of butt which isnt the same as a comparator. 2 if you're using a comparator in a bunch of different locations and need to update the logic you do it inside the comparator and you're done. in your shitlanguages you'd have to search and replace for all your compares. 3 the java is far more readable than gross rear end shitlanguages

1 is a valid point since you might not always want to sort on the natural order (usually us), but at least the python sort implemention can take an optional cmp argument that specifies a comparator function. That also solves 2, or you can just put the sort in its own function. 3... is debatable. I think key=[function] and cmp=[function] is perfectly understandable unless you are really dumb.

The java way works but the ability to easily sort any list by an arbitrary key is pretty cool since usually that's the kind of sorting you do anyway.

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Ronald Raiden posted:

1 is a valid point since you might not always want to sort on the natural order (usually us), but at least the python sort implemention can take an optional cmp argument that specifies a comparator function. That also solves 2, or you can just put the sort in its own function. 3... is debatable. I think key=[function] and cmp=[function] is perfectly understandable unless you are really dumb.

The java way works but the ability to easily sort any list by an arbitrary key is pretty cool since usually that's the kind of sorting you do anyway.

does python have both comparator sort and a schwartzian transform sort-by method

Catalyst-proof
May 11, 2011

better waste some time with you

Ridgely_Fan posted:

if your changing what your comparing, you will need to name the new comparator something else, and youll have to find and replace anyway.

shaggargument is specious

i think what he's sayign is that if you have a comparator that adheres to an interface, and you change how things are compared, you can just change the one class and all the instances will follow suit

which you could handle in python by passing around an object which implements the special method __cmp__, in which case you don't need to pass a lambda to sorted at all. it's really a question of what's pythonic, i suppose. most people just want to pass around dicts with god-knows-what in them, but if you're doing that i hope it's constrained to a method or two and not splayed all over your codebase

Emacs Headroom
Aug 2, 2003

BonzoESC posted:

does python have both comparator sort and a schwartzian transform sort-by method

shwartzian transform is considered "the old way" but yeah you can do it that way

Jonnty
Aug 2, 2007

The enemy has become a flaming star!

Zombywuf posted:

1)
Python code:
sort(key=lambda x: x.butt.size)
Happy now?

2) Do you often go around changing the total order's of numbers?

3) At least my examples fit on the screen.

that doesn't do anything like what he asked for loving hell you're dense.

Python code:
class ButtCheek(object):
  #define everything

  def __cmp__(self, other):
    return self.size.__cmp__(other)

sort(butts)
then if you suddenly want to change the natural ordering to specifically width or whatever then you just change it and everything works. simple.

but seriously if you find it difficult remembering the basic java interfaces like comparator then you're quite stupid, they're just loving annoying to work with.

Adbot
ADBOT LOVES YOU

Cocoa Crispies
Jul 20, 2001

Vehicular Manslaughter!

Pillbug

Ridgely_Fan posted:

shwartzian transform is considered "the old way" but yeah you can do it that way

"In Python 2.4 and above, both the sorted() function and the in-place list.sort() method take a key= parameter that allows the user to provide a "key function" (like foo in the examples above). In Python 3 and above, use of the key function is the only way to specify a custom sort order (the previously-supported comparator argument was removed)."

i guess that's "the new way" or maybe "the only way" now

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