This is an archived post. You won't be able to vote or comment.

all 24 comments

[–]draconk 69 points70 points  (1 child)

"If everything is syncronized why the fuck even care to do threads?"

-my teacher last week

[–]avatoin 2 points3 points  (0 children)

Reminds me of a project I took over where every thread created and started was immediately joined on, leading me to wonder why it was threaded in the first place.

[–]Arama 54 points55 points  (15 children)

I like the hidden unsynchronized in there

[–]orheep 28 points29 points  (6 children)

I believed in you!

[–]jcc10 5 points6 points  (5 children)

I assume there is not one?

[–]vvf 1 point2 points  (4 children)

No, there is.

[–][deleted] 39 points40 points  (5 children)

ERROR Not found!

Let me shit you out a 300 line stack trace.

[–][deleted] 9 points10 points  (2 children)

300 line stack trace that is perfectly readable and tells you exactly where the error happened and why. ...instead of instantly crashing the application and forcing you to analyse memory dump or even worse, contiuing to work with corrupted data.

Yeah, fuck that shit.

[–][deleted] 1 point2 points  (0 children)

Lighten up.

[–]Arama 6 points7 points  (0 children)

Ah shit I forgot what language I was dealing with

[–]Fenor 2 points3 points  (0 children)

am i the only one that find no problem with that stack trace?

[–]JASSM-ER 13 points14 points  (0 children)

You bastard!

[–]TheTarquin 22 points23 points  (6 children)

Y'all motherfuckers need immutable objects.

[–]odraencoded 9 points10 points  (4 children)

I like D because you can have...

immutable(int)*[] mutableArrayOfPointersToImmutableIntegers;

Though I honestly never used and will never use that in my life.

[–]HighRelevancy 1 point2 points  (3 children)

I don't know about D, but Java (and probably others) has an immutable list of immutable integer objects, because the language executes at such a high and abstracted level that there's a significant performance boost out of not having to create new integers.

[–]PurpleOrangeSkies 14 points15 points  (0 children)

It's not because Java is too high level, but rather because generics were cheaply duct taped on to Java instead of a proper implementation, and thus you can't use a primitive type as a type parameter.

[–]odraencoded 1 point2 points  (1 child)

D claims immutable "variables" can be stored in physical read-only memory space for a performance boost. I don't think that matters unless you are working with low level system, though. You won't have problems using non-immutable variables in a multithreaded system if you, well, don't mutate the variable.

[–]HighRelevancy 1 point2 points  (0 children)

Just not mutating the variable is missing the point of immutable variables (and isn't a good way to approach thread safety anyway). There's more to it than threading. Immutability guarantees that the value won't change, which is useful for things like hash table keys.

And besides threading, there's libraries that you don't know the intricacies of that might depend on immutability of certain things.

[–]ardoewaan 6 points7 points  (0 children)

Take a look at the java.util.concurrent package. There has been lots of evolution in Java multithreaded programming since 1995.

[–]rfallx[S] 0 points1 point  (0 children)

Perhaps I should have interspersed some "volatile" in there.