create new tag
, view all tags
I think there are a number of nuances to "immutable", so I'm first going to mention some of those nuances, then perhaps attempt an all encompassing definition.




Nuance 1 -- const

An object that is intentionally not changable (for some good reason -- to be expanded later).

Nuance 2 -- immutable set iterator

Here's a potential problem (and I've run into things like this before) -- suppose you iterate through some collection of objects based on their names in alphabetical order. Suppose you change the name of one of the objects while iterating through the collection -- the potential exists to visit that object twice, which might not be the desired behavior.

Hence there are ways to make the set iterator immutable. (This probably needs a lot of work, but it's a start.)

Some relevant resources:

Aside: C++ allows things like a "const reference to a mutable object" -- Python apparently does not -- [[http://mail.python.org/pipermail/c++-sig/2002-September/002127.html][[C++-sig] C++ const -> Python immutable?]]; David Abrahams; c++-sig@pythonPLEASENOSPAM.org; 25 Sep 2002

Nuance 3 -- immutable strings are duplicated, not mutated

This might be Python specific behavior (or behavior that is not general to all programming languages that have immutable strings), but here's a quote from a .pdf on Python: "Strings in Python are immutable, meaning that when you perform an operation on a string, you always produce a new string object rather than mutating the existing string." (from Chapter 4: The Python Language, an online sample of O'Reilly's Python in a Nutshell — I wonder what the advantage of immutable strings is?


Some interesting pages on Ward's Wiki (looks like there may be more and more useful stuff over there -- I don't want to duplicate it -- I think there is still a place for Wikilearn for the people learning C++ (or whatever) -- the stuff on Ward's Wiki might be considered more appropriate for experienced practioner's of (things like) C++:

Then I think we can potentially start to get degenerate cases of immutability (not sure when we'll cross that line, but I mean sort of like "virtual" (or "alias") -- an awful lot of things are described as virtual, so many that it is sometimes hard (for me) to really understand what someone is saying.

One meaning of an immutable interface relates to different versions of a program (or library) under development -- if the interface is immutable (not changed) between versions of a library, then programs that use the old version of the library might work with the new version of the library (or at least link). The developer's of wxwindows try to keep interfaces immutable except between major versions. I'm not sure though that there is any keyword built into C++ that helps them do that (keep the interface unchanged) or whether it's strictly a manual effort / discipline.

If it's strictly a manual effort / discipline, I guess I would consider it some sort of degenerate case of immutability.

<Currently, no significant content below this line.>


See ResourceRecommendations. Feel free to add additional resources to these lists, but please follow the guidelines on ResourceRecommendations including ResourceRecommendations#Guidelines_for_Rating_Resources.


  • (rhk) [[][]] --

Recommended for Specific Needs

  • (rhk) [[][]] --

Recommended by Others

  • (rhk) [[][]] --

No Recommendation

  • (rhk) [[][]] --

Not Recommended

  • (rhk) [[][]] --


  • () RandyKramer - 26 Nov 2002
  • <If you edit this page: add your name here; move this to the next line; and include your comment marker (initials), if you have created one, in parenthesis before your WikiName.>

Page Ratings

Edit | Attach | Watch | Print version | History: r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r2 - 2003-04-23 - RandyKramer
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WikiLearn? WebBottomBar">Send feedback
See TWiki's New Look