Immutability in C# Part Five: LOLZ!

Immutability in C# Part Five: LOLZ!

Rate This
  • Comments 10

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!

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

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

  • Yeah, stupid i++ !

  • 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.

  • 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.

  • 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.

  • 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

  • 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

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

  • 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.

Page 1 of 1 (10 items)