Share via


Immutability in C# Part Five: LOLZ!

My sadly soon-to-be-erstwhile coworker Cyrus made me a lolgeek shirt to go with this series of blog articles:

ShirtFront ShirtBack

Cyrus, needless to say, is a big goof. Thanks, dude!

Comments

  • Anonymous
    December 14, 2007
    Is it wrong that I love this sort of thing?  Alas, I'm a nerd, through and through.

  • Anonymous
    December 14, 2007
    But I must say that i++ spoils all the fun. We are talking about immutable data structures and it mutates 'i'.

  • Anonymous
    December 14, 2007
    Yeah, stupid i++ !

  • Anonymous
    December 14, 2007
    Well, the object held in "i" isn't mutated (probably, we can't be sure because maybe "i" isn't an int and there is some funky operator overloading going on) the variable "i" is just set to something else.

  • Anonymous
    December 15, 2007
    Trust your instinct. I am not a compiler who is paranoid of even ++ and the language ain't C# either where overloading + automatcially gives you cousins for free. I must assume that ++ mutates the object it is invoked on.

  • Anonymous
    December 15, 2007
    I am not following the train of thought of either of you. If i contains an int then the int is not mutated; ints are immutable. The operand of the ++ operator is always a variable. No matter what the type of the variable is, and no matter what is presently stored in that variable, a successful ++ operation always mutates the variable.  Whether the contents of the variable are mutable or immutable is irrelevant; the variable is going to change. (Well, someone could write a ++ operator which set the variable to its current value, not mutating it, but we could characterize the trivial mutation as a mutation for the sake of argument.) Hence the shirt -- i'm mutating your variables.

  • Anonymous
    December 17, 2007
    alright... that was deep; i now fully appreciate that shirt... as obvious to before you explained it... i didn't get it :] lol.... I must of re-read your explaination at least 4 times before getting it though; -mike

  • Anonymous
    December 18, 2007
    O.K. The shirt is fun but a variable is not in the realm of Data Structures! In this context 'i++' can only mean a better 'i'mmutable Data  Structure! ( as C++ means a better C ) So keep up the good work, Sasan

  • Anonymous
    January 18, 2008
    For some reason, there's been a lot of buzz lately around immutability in C#. If you're interested in

  • Anonymous
    April 29, 2008
    The mark of a true geek. See a joke about a computer science concept and then dissect it to see if it's really funny.