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
Munkeymon
Aug 14, 2003

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



Janin posted:

Or you could just use exceptions. Obviously you've learned, or been taught, that exceptional circumstances are inherently errors. In Python, this is not the case; an exception just means that the code was unable to finish executing, for any reason.

If exception handling was to be replaced with another paradigm, I'd prefer something like LISP's conditions.

It does look an awful lot like Guido shoehorned what would be an event anywhere else into the exception model because, in the context of every other language I have used, this is strange behavior. Conditions already look like a better idea just because they don't try to call a shoe a sock.

Munkeymon fucked around with this message at 22:21 on Nov 7, 2008

Adbot
ADBOT LOVES YOU

Fenderbender
Oct 10, 2003

You have the right to remain silent.

Misogynist posted:

Scientists do not know Perl

This cannot be stressed enough.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Munkeymon posted:

It does look an awful lot like Guido shoehorned what would be an event anywhere else into the exception model because, in the context of every other language I have used, this is strange behavior. Conditions already look like a better idea just because they don't try to call a shoe a sock.

What languages have you used? If you've only used the C family (C++/C#/Java) then the idea of a non-error exception will seem strange, but to understand Python you need to realize that they are different concepts.

Munkeymon
Aug 14, 2003

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



Janin posted:

What languages have you used? If you've only used the C family (C++/C#/Java) then the idea of a non-error exception will seem strange, but to understand Python you need to realize that they are different concepts.

It's often a good idea to give different concepts different names - and possibly even different structure - to avoid confusion. When you borrow the name and structure for a construct like exceptions from the popular language crowd and then subtly change what it's generally used for, you create a situation where problems are more likely for most programmers who use your language. I could also see a Python-taught programmer bringing this concept to a different language and making a huge mess.

Anyway, it's silly to argue over this now since it's not going to go back in time and affect Guido's decision, but I think he screwed up there. Not a huge deal, but still not the best idea he's had.

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.
People seem to be arguing over fundamentally different definitions of "exception". If there was ever an overloaded term in the realm of coding, it's "exception". It means everything to everybody. Janin almost hit it: if you come into Python thinking "'exception' means non-Python definition x", it won't look right. Part of making your own language is deciding what "exception" means to you.

Wikipedia's definition of exception handling is something that is "designed to handle the occurrence of a condition that changes the normal flow of execution". That definition seems general enough to include the case where a generator/iterator/etc. can't continue executing normally because there's nothing left to generate/iterate/etceterate. Beyond that, it's up to the language.

BigRedDot
Mar 6, 2008

Seriously, what is attempting to iterate past the end of a sequence, if not an exceptional circumstance?

Vanadium
Jan 8, 2005

A logic error that deserves to be punished with undefined behaviour~

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

BigRedDot posted:

Seriously, what is attempting to iterate past the end of a sequence, if not an exceptional circumstance?

The language shouldn't even let you :colbert:

Victor
Jun 18, 2004

BigRedDot posted:

Seriously, what is attempting to iterate past the end of a sequence, if not an exceptional circumstance?
This is standard operating procedure. In many, many different APIs, Read() will return 0 or null or some other sentinel value that there are no more values to consume. C++'s STL has iterators that evaluate to .end() when iteration is done -- .end() is not actually a valid element, it is one past the end of the sequence. The very nature of loops in [most] programming languages dictates that being able to get a last element that will never need to be processed (instead, it provides a sentinel value for a boolean "break out of this loop" test) is very useful. A fake, end-of-sequence element is occasionally added to facilitate this. No, exceptions are an ugly solution here, but may be the most elegant as stated above. I'm not sure whether static analysis makes this easier/possible, but the C# compiler implements iterators as state machines. No exceptions are required.

Victor fucked around with this message at 22:03 on Nov 8, 2008

Zombywuf
Mar 29, 2008

Janin posted:

If generators do their work in has_next(), then what should happen when they raise an exception? Does it appear from the has_next() call? That's awfully awkward.

The generator is not "making a mess". Many generators have side effects, and it's important that the side effects happen at the prescribed time. I inserted the sys.exit() to prevent arguments about pre-caching results; often, the results themselves are unimportant and it's the side-effects of the generator that matter.

Calling sys.exit() from the middle of a generator is making a mess. Depending on order of evaluation of generators is to rely on spooky action at a distance. If you want side effect but no results, why are you using a generator? The clue is in the name, it generates output.

quote:

The issue with using a has_next()/get_next() style is that it's not as general as the current system. Any loop implemented with has/get_next() can be wrapped in a generator, but the converse is not true because the behavior of a generator allows unpredictable results.

code:
try:
  while True:
    do_stuff(mygen.next())
except GeneratorExit, e:
  pass
Is frankly vile. If you use the for ... in ... construct it makes no difference when an exception is thrown from the generator, nor if you use list comprehensions. The only thing I can think of this construct being good for is that it makes it slightly easier to implement your own generator class. However python doesn't seem to accept any old class with a next() method as a generator :-(.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Zombywuf posted:

Calling sys.exit() from the middle of a generator is making a mess. Depending on order of evaluation of generators is to rely on spooky action at a distance. If you want side effect but no results, why are you using a generator? The clue is in the name, it generates output.

If you want a language with carefully-managed side effect handling, use Haskell. The imperative nature of Python precludes stateless generators.

You are also ignoring that sys.exit() is just an example of a side effect; it could be anything else. Here's a simple coroutine example; how would you implement this using has/get_next()? has_next() wouldn't be able to advance beyond the current point, because the generator requires a value from the yield statement to work.

code:
def my_gen ():
	a = yield
	b = yield
	yield a + b

gen = my_gen ()
gen.next ()
gen.send (1)
print gen.send (2)

Zombywuf posted:

code:
try:
  while True:
    do_stuff(mygen.next())
except GeneratorExit, e:
  pass
Is frankly vile. If you use the for ... in ... construct it makes no difference when an exception is thrown from the generator, nor if you use list comprehensions.

Shouldn't that code just use for..in?

Zombywuf posted:

The only thing I can think of this construct being good for is that it makes it slightly easier to implement your own generator class. However python doesn't seem to accept any old class with a next() method as a generator :-(.

I don't understand what you mean, here. If you mean custom iterables, that's easy to do. If you mean actual custom generator classes, why on earth would you want to?

Zombywuf
Mar 29, 2008

Janin posted:

If you want a language with carefully-managed side effect handling, use Haskell. The imperative nature of Python precludes stateless generators.
I never said the language should manage side effects. I said that if you're using generators for their side effects you're doing it wrong.

quote:

You are also ignoring that sys.exit() is just an example of a side effect; it could be anything else. Here's a simple coroutine example;
No I'm not, depending on side effects from a generator where the rest of your program interacts with those side effects during the generator's execution is a bad idea.

quote:

how would you implement this using has/get_next()? has_next() wouldn't be able to advance beyond the current point, because the generator requires a value from the yield statement to work.

PEP 342 effectively redefined next to mean send(None). Handling this case is just matter of having a "has next when sent a" function. This is easily handled with an optional argument on the has_next().

quote:

Shouldn't that code just use for..in?
Yes, my point is that you'll only ever see the behavior of using an exception to stop iteration if you do something badly wrong.

quote:

I don't understand what you mean, here. If you mean custom iterables, that's easy to do. If you mean actual custom generator classes, why on earth would you want to?

You probably wouldn't, yet the design seems to be geared around making it easier.

TOO SCSI FOR MY CAT
Oct 12, 2008

this is what happens when you take UI design away from engineers and give it to a bunch of hipster art student "designers"

Zombywuf posted:

I never said the language should manage side effects. I said that if you're using generators for their side effects you're doing it wrong.

No I'm not, depending on side effects from a generator where the rest of your program interacts with those side effects during the generator's execution is a bad idea.

Unless the language prevents all side effects within a generator, it's not possible to reliably implement has_next().

Zombywuf posted:

PEP 342 effectively redefined next to mean send(None). Handling this case is just matter of having a "has next when sent a" function. This is easily handled with an optional argument on the has_next().

So you would prefer the code to be expanded to this:

code:
gen = my_gen ()
gen.has_next ()
gen.next ()
gen.has_next_when_sent (1)
gen.next ()
gen.has_next_when_sent (2)
print gen.next ()
to achieve...what, exactly?

Zombywuf posted:

Yes, my point is that you'll only ever see the behavior of using an exception to stop iteration if you do something badly wrong.

:psyduck: This is an argument for exception-based iteration

Zombywuf posted:

You probably wouldn't, yet the design seems to be geared around making it easier.

Not really; the use of iterators with next() makes implementing custom iterables easier, but that's got nothing to do with custom generators.

---------------------

Also, here's a word from the original developer:

quote:

<<Fix for memory leak>>> every dev read

the title says it all ... after alot of testing i found out that the text drawing using ctx causes a memory because the ctx memory isnt cleared , we got to fix it
you will only ontice it on screenlets that update very quickly
here is why is appends

traditionaly python has problems freeing memory it uses because it normally store vars forever , here's what appends in the text memory leak
in def on_draw
p_layout = ctx.create_layout()

in here python stores the p_layout , the next time it redraws it stores it again and again and again , thats why we get a memory leak

how do we fix it , simple

first provide a global var

class NetmonitorScreenlet(screenlets.Screenlet):

p_layout = None

then in on_draw

if self.p_layout == None :

self.p_layout = ctx.create_layout()
else:

ctx.update_layout(self.p_layout)

thats it , now we just update the var instead of creating a new one :)

tef
May 30, 2004

-> some l-system crap ->
I found out this week why certain bits of code are slow at work.


We have a cache of ticket prices - I thought this was a simple as the ticket details (people, date) being the key, and the price being the value in a hash.

It turns out that he constructs the key from the ticket details and the price, just to be sure.

Unfortunately this means he can't then do a simple lookup, so he iterates through the hash values to find it.


"iterating over the keys of a hash is like clubbing someone to death with a loaded Uzi." - larry wall.

spiritual bypass
Feb 19, 2008

Grimey Drawer
So I'm a PHP developer at an internet marketing (spam) company. We have two developers, and the other one is leaving soon. We're set to interview a guy on Friday, so about 15 minutes before the interview I actually look at his resume and Google his name.

He's got a blog, a video blog, and a Twitter. He's got a BS in "Legal Studies" and master's in "Information Technology" from an unaccredited (fake) online university. I managed to look at his video blog and find out that he won't accept less than 85k salary. For reference, I graduated with my BS in CS in May and am making 38k at this company.

Still looking at his video blog, I notice another video with a screenshot of something other than his face. Unfortunately, I decided to click on it.

"Oh wow, this must be some sort of scuba diving video."

NOPE!

Turns out it's a camera inside his ureter recording several minutes of a surgeon removing some cysts.:goatsecx: Thanks for posting that on the internet! I'd love to work alongside you since you have a fake degree, no real education that would help you as a developer, an ego that makes you think people want to read your Twitter and watch your video blog, and weird diseases. Surely he will redeem himself in the interview! Of course, this is SA so you already know what happens.

To make a long story short, he failed to answer these questions:
Write a recursive function to do factorial (he didn't know what recursion meant)
Name a way that Linux differs from real UNIX (no idea, but not a big deal)
How do you prevent SQL injections? (he had never heard of prepared statements/parameter queries)

I'm sure there's more to say, but I wager this post is getting boring at this point. Maybe I'll post a link tomorrow if y'all really want it. Hopefully we'll have some more hilarious interviews coming up before my coworker quits and leaves me in charge of software that I can barely maintain, let alone extend! :cry:

spiritual bypass fucked around with this message at 20:17 on Nov 16, 2008

willemw
Sep 30, 2006
very much so
Today I had to do some maintenance on the administration part on one of our websites. You can link some stuff to one of 15 different locations.

Here's how they did it:
php:
<?php
switch($selected){
    case 1:
        $q .= "location1='selected', ";
        $q .= "location2='', ";
        $q .= "location3='', ";
        $q .= "location4='', ";
        $q .= "location5='', ";
        $q .= "location6='', ";
        $q .= "location7='', ";
        $q .= "location8='', ";
        $q .= "location9='', ";
        $q .= "location10='', ";
        $q .= "location11='', ";
        $q .= "location12='', ";
        $q .= "location13='', ";
        $q .= "location14='', ";
        $q .= "location15=''";
        break;
    case 2:
        $q .= "location1='', ";
        $q .= "location2='selected', ";
        $q .= "location3='', ";
        $q .= "location4='', ";
        $q .= "location5='', ";
        $q .= "location6='', ";
        $q .= "location7='', ";
        $q .= "location8='', ";
        $q .= "location9='', ";
        $q .= "location10='', ";
        $q .= "location11='', ";
        $q .= "location12='', ";
        $q .= "location13='', ";
        $q .= "location14='', ";
        $q .= "location15=''";
        break;    
//ommitted
    default:
        $q .= "location1='', ";
        $q .= "location2='', ";
        $q .= "location3='', ";
        $q .= "location4='', ";
        $q .= "location5='', ";
        $q .= "location6='', ";
        $q .= "location7='', ";
        $q .= "location8='', ";
        $q .= "location9='', ";
        $q .= "location10='', ";
        $q .= "location11='', ";
        $q .= "location12='', ";
        $q .= "location13='', ";
        $q .= "location14='', ";
        $q .= "location15=''";
}
?>

:psypop:

Jethro
Jun 1, 2000

I was raised on the dairy, Bitch!

willemw posted:

Today I had to do some maintenance on the administration part on one of our websites. You can link some stuff to one of 15 different locations.

:psypop:
So is this the mystical unrolled for-case?

karms
Jan 22, 2006

by Nyc_Tattoo
Yam Slacker

Jethro posted:

So is this the mystical unrolled for-case?

Duff's Enigma.

Smugdog Millionaire
Sep 14, 2002

8) Blame Icefrog

They go against the C# NamingConventions but that doesn't bug me too much. Except for when they don't. I couldn't decide if I should name the file namespaces.png or NameSpaces.PNG, so I just uploaded them both :downs:

Jerk Burger
Jul 4, 2003

King of the Monkeys

royallthefourth posted:

Thanks for posting that on the internet! I'd love to work alongside you since you have a fake degree, no real education that would help you as a developer, an ego that makes you think people want to read your Twitter and watch your video blog, and weird diseases.
Yes because having cysts==bad programmer.

The fake qualifications aren't good, and I guess saying online that you won't work for under $85k could turn off some employers, but really who gives a poo poo if a prospective employee:
  • uses Twitter
  • posts video of an operation

spiritual bypass
Feb 19, 2008

Grimey Drawer

amanvell posted:

Yes because having cysts==bad programmer.

The fake qualifications aren't good, and I guess saying online that you won't work for under $85k could turn off some employers, but really who gives a poo poo if a prospective employee:
  • uses Twitter
  • posts video of an operation

Those two points served as evidence that he was utterly socially inept. I work very closely with my co-developer and I need to be able to replace him with somebody that is easy to work with. Someone who thinks he is so important that I need to be updated on his life every hour or thinks that posting surgery videos online is a good idea is probably not someone that I want reading code over my shoulder.

Most importantly, I thought it had good comedy value.

Kilson
Jan 16, 2003

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

willemw posted:

Today I had to do some maintenance on the administration part on one of our websites. You can link some stuff to one of 15 different locations.

Here's how they did it:
php:
<?php
switch($selected){
    case 1:
...
}
?>


There's plenty of code like that in the codebase I work with. :cry:

We also have this:

code:
  public static enum State {
    AL, AK, AZ, AR, CA, CO, CT, DE, FL, GA,
    HI, ID, IL, IN, IA, KS, KY, LA, ME, MD,
    MA, MI, MN, MS, MO, MT, NE, NV, NH, NJ,
    NM, NY, NC, ND, OH, OK, OR, PA, RI, SC,
    SD, TN, TX, UT, VT, VA, WA, WV, WI, WY
  }
Oh good, a Java enum. This will give us plenty of nice ways to use this data.
But we can't be bothered to use this in the proper way. Instead we get this monstrosity:

code:
  public static Constants.State toState(String state) {
    if (state == null) {
      return null;
    } else if (state.equalsIgnoreCase((Constants.State.AL).toString())) {
      return Constants.State.AL;
    } else if (state.equalsIgnoreCase((Constants.State.AK).toString())) {
      return Constants.State.AK;
    // EVERY OTHER STATE ...
    } else {
      return null;
    }
  }

No Safe Word
Feb 26, 2005

royallthefourth posted:

Those two points served as evidence that he was utterly socially inept. I work very closely with my co-developer and I need to be able to replace him with somebody that is easy to work with. Someone who thinks he is so important that I need to be updated on his life every hour or thinks that posting surgery videos online is a good idea is probably not someone that I want reading code over my shoulder.

Most importantly, I thought it had good comedy value.

While I mostly agree with you...

royallthefourth posted:

Someone who thinks he is so important that I need to be updated on his life every hour

...that's not necessarily what twitter is about. I didn't see anything in your story that said it was like that, just that he had one, and I'm just wondering if you just jumped to that conclusion. Twitter (and its relatives) can be fine and not just for attention whores.

Lonely Wolf
Jan 20, 2003

Will hawk false idols for heaps and heaps of dough.

Mercator posted:

Duff's Enigma.

You just made a long terrible day melt away into laughter. I decree this to be its official name.

spiritual bypass
Feb 19, 2008

Grimey Drawer

No Safe Word posted:

...that's not necessarily what twitter is about. I didn't see anything in your story that said it was like that, just that he had one, and I'm just wondering if you just jumped to that conclusion. Twitter (and its relatives) can be fine and not just for attention whores.

I understand that Twitter is simply a tool. I read a couple days of his feed and it was pretty douchebaggy, but I guess my first post didn't reflect this. His awkward online presence would only be considered a real factor if he was very skilled yet socially inept and there was someone else equally skilled but more personable. The main reason he didn't get hired is because he's incompetent.

Anyway, it all struck me as very funny in a sad kind of way, which is the sort of thing goons enjoy. The interview made me feel like I had walked into the Weekend Web, but I guess I'm not good enough at writing comedy to make the experience make sense in a forum. Next time, I'll post hilarious code and let that speak for itself.

HappyHippo
Nov 19, 2003
Do you have an Air Miles Card?
This is psuedocode.
I was having trouble figuring out why the test could never fail...

code:

function Test()
{
        //Load of stuff

        DoSomeStuff("01", //more arguments...

        //Other stuff
}


function DoSomeStuff(string ValueToWrite, //more arguments...
{
        WriteRegister(ValueToWrite); //can handle "01" or "1" just fine (writes to some hardware over USB)
        
        //Some stuff

        if(ValueToWrite == "1")
        {
                if(ReadRegister() != ExpectedValue)
                        TestFails();
        }

        //More stuff
}

Poeple here sure love to use strings where they shouldn't.

ymgve
Jan 2, 2004


:dukedog:
Offensive Clock

royallthefourth posted:

So I'm a PHP developer at an internet marketing (spam) company.

How the gently caress can you take the high ground here? Sure, he went to fake schools and posted gross videos online, but you're part of the loving spamming business!

Go die.

ymgve fucked around with this message at 11:28 on Nov 19, 2008

TheSleeper
Feb 20, 2003

ymgve posted:

How the gently caress can you take the high ground here? Sure, he went to fake schools and posted gross videos online, but you're part of the loving spamming business!

Go die.

Sometimes it's just a job man, chill out.

JoeNotCharles
Mar 3, 2005

Yet beyond each tree there are only more trees.

TheSleeper posted:

Sometimes it's just a job man, chill out.

You are in fact responsible for what you do at work.

Fenderbender
Oct 10, 2003

You have the right to remain silent.

TheSleeper posted:

Sometimes it's just a job man, chill out.

Yeah, well, you know who else were JUST FOLLOWING ORDERS?!?!

spiritual bypass
Feb 19, 2008

Grimey Drawer

ymgve posted:

How the gently caress can you take the high ground here? Sure, he went to fake schools and posted gross videos online, but you're part of the loving spamming business!

Go die.

Everyone who gets spam from my company opts-in. I designed the database that keeps track of our e-mail addresses and the service that receives them from our partners. It honors unsubscribe requests! Nobody can get spam from my company without explicitly asking for it.

I never claimed any moral high ground here anyway; I claim a professional high ground based on the fact that I can actually write computer programs. Of course, you've got some mighty strong moral values if you think people who work for relatively honorable spam businesses should be killed.

In case you're wondering, I'd rather not be developing crappy web marketing apps. I'd really like to work on something interesting, like writing software at NASA or programming robots. I had to take a job somewhere, and this place has actually treated me pretty well.
I don't have any problems sending spam to people who explicitly ask for it and then don't bother to click the opt-out link at the bottom of every email.

JoeNotCharles
Mar 3, 2005

Yet beyond each tree there are only more trees.

royallthefourth posted:

Everyone who gets spam from my company opts-in. I designed the database that keeps track of our e-mail addresses and the service that receives them from our partners. It honors unsubscribe requests! Nobody can get spam from my company without explicitly asking for it.

Then it's not spam.

geetee
Feb 2, 2004

>;[

JoeNotCharles posted:

Then it's not spam.

He's not the one that made a big todo about it.

Back to the thread:
php:
<?
$LIVE_PRODUCTION_FLAG='TEST';
//Change above only to 'ON' or 'TEST'.
?>
If that "flag" wasn't bad enough, no less than 5 lines down:
php:
<?
if (isset($LIVE_PRODUCTION_FLAG) && ...) {
?>
I'm pretty sure it's still set to some obnoxious value.

Munkeymon
Aug 14, 2003

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



geetee posted:

php:
<?
$LIVE_PRODUCTION_FLAG='TEST';
//Change above only to 'ON' or 'TEST'.
?>
If that "flag" wasn't bad enough, no less than 5 lines down:
php:
<?
if (isset($LIVE_PRODUCTION_FLAG) && ...) {
?>
I'm pretty sure it's still set to some obnoxious value.

What, you don't think they should test the live production flag :holy:

JoeNotCharles
Mar 3, 2005

Yet beyond each tree there are only more trees.

geetee posted:

He's not the one that made a big todo about it.

I'm just saying that posting, "I work for a spammer" is a good way to get people to hate you, and if what you're doing is not actually spam calling it that is pretty stupid.

Campbell
Jun 7, 2000
I just got done debugging a custom javascript image rotator that was spawned in hell. There was a basic javascript error, which wasn't a big deal. What was the big deal was that the rotator was a custom control project that existed only on that ex-employee's machine.

And all the javascript was done server-side and fed line by line into a StringBuilder which looked like this:

sb.Append("function buttes() ");
sb.Append("\r");
sb.Append("{");
sb.Append("\r");
sb.Append("if (this==that) ");
sb.Append("\r");
sb.Append("{");

gently caress I JUST NEED TO CORRECT YOUR INSANE JAVASCRIPT SO THE setTimeout() IS APPLIED TO A VARIABLE AND CAN BE CLEARED. BUT FINDING THE ACTUAL TIMEOUT IS A NEEDLE IN YOUR STRINGBUILDER HAYSTACK! :argh:

Victor
Jun 18, 2004
The real WTF is in several online tutorials that teach you to use a StringBuilder for instances such as the above, instead of letting the compiler automatically combine all the string constants into one. It's pretty sad.

Flobbster
Feb 17, 2005

"Cadet Kirk, after the way you cheated on the Kobayashi Maru test I oughta punch you in tha face!"

Victor posted:

The real WTF is in several online tutorials that teach you to use a StringBuilder for instances such as the above, instead of letting the compiler automatically combine all the string constants into one. It's pretty sad.

Not only that, but even in the case of appending a bunch of string constants and string variables together, the Java compiler is smart enough (that's a phrase you don't hear too often!) to compile that into a StringBuilder construction and sequence of append() calls. I never knew this until I had to decompile a class for something and saw that.

I wonder under what conditions this transformation occurs -- without compiling an example, I bet it only applies to a single statement at a time. Still, it really cuts down on the number of times that you actually need to use StringBuilder explicitly.

vvv Fair enough, I suppose my beef with Java is with the design of the core language and not the compiler. It's just hard to be nice when Java's the topic of conversation :bahgawd:

Flobbster fucked around with this message at 22:11 on Nov 19, 2008

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

Flobbster posted:

the Java compiler is smart enough (that's a phrase you don't hear too often!)
Sun's javac is probably one of the best compilers on earth. Do you have an example of it making poo poo code that breaks HotSpot or something?

Adbot
ADBOT LOVES YOU

Campbell
Jun 7, 2000
In my case, I was actually working with a c# project. However, I imagine that the javascript would be equally unreadable regardless of what was used on the serverside :)

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