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 (10)
  1. Luke says:

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

  2. Tanveer Badar says:

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

  3. silky says:

    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.

  4. Tanveer Badar says:

    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.

  5. Eric Lippert says:

    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.

  6. Mike says:

    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;


  7. Sasan Jalali says:

    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,


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

  9. Richard says:

    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.

Comments are closed.

Skip to main content