Talk:Immutable object
| This article is rated C-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||||||||||
| ||||||||||||||||||||||||
|
This article contains broken links to one or more target anchors:
The anchors may have been removed, renamed, or are no longer valid. Please fix them by following the link above, checking the page history of the target pages, or updating the links. Remove this template after the problem is fixed | Report an error |
InmutableChart
there is an error: ImmutableCart is immutable only if elements of the list are themselves immutable. Otheriwse, you copy the list allright, but you share the elements with the caller, so he can mutate them as he pleases. —Preceding unsigned comment added by 128.30.84.40 (talk • contribs) 18:40, 19 November 2005
- I disagree. It depends on what you consider part of the "ImmutableCart" object. I consider an "ImmutableCart" object to contain only its fields, i.e. the reference "items". Under this definition, "ImmutableCart" is indeed immutable. --Spoon! 09:03, 18 March 2007 (UTC)
- Wouldn't this imply that the Cart class is immutable too? I.e. the 'items' reference never changes (although its contents may change). Zedoo (talk) 18:28, 16 August 2008 (UTC)
I changed all references to vector in the C++ example to std::vector, as the C++ example would presumably be in a header file and it is generally considered bad style to include a global using namespace directive in a header file. I think it's very important for code examples to exhibit good style even if that makes them a little more verbose. - Zixyer 02:24, 19 December 2005 (UTC)
why does defensive copying link to object (computer science) which has no information as to what "defensive copying" means probably a mistake, can somebody correct? --Alex 11:10, 30 December 2005 (UTC)
- I changed the defensive copy redirect to go to Object copy instead, which talks about defensive copying.Tim Dean 22:07, 31 December 2005 (UTC)
List to Array to List?
I'm not a C# guy so I was afraid to make the change myself, but does anyone else see anything wacky about ImmutableCart's constructor? I checked the docs and it looks like List has a constructor that takes a collection as an argument, presumably creating a new list containing the same objects as the old one.
Is there a good reason why the example takes the input List, turns it into an array, then turns it into a new List? Guess I'll just make the change... tfrey 21:31, 14 April 2008 (UTC)
- Because it's not C# but Java, and List is (last time I checked) not a class and cannot be instantiated. I'm reverting the change. -- Taku (talk) 11:53, 4 May 2008 (UTC)
- But wouldn't
Collections.unmodifiableList(items)be better in both cases? --131.159.0.7 (talk) 14:57, 14 June 2008 (UTC)
- But wouldn't
No, because Collections.unmodifiableList(items) doesn't create a copy of a list. items.toArray(), on the other hand, gives a copy of an array (not the underlying array.) -- Taku (talk) 20:55, 14 June 2008 (UTC)
Need for disambiguation
"Mutability" is also used in the biological sciences. E.g. In Voet&Voet, 2011, p3, "Life possesses the properties of replication, catalysis, and mutability." 86.184.76.240 (talk) 16:02, 20 January 2011 (UTC)
Error in c++ example
The first example in the c++ is not fully immutable. By returning a reference in the non-const getItems() you allow the priovate data to be edited. see my example on ideone: http://ideone.com/kWhakl This function needs to either return a copy or a const reference, then the function marked as const. — Preceding unsigned comment added by 108.47.10.190 (talk) 16:07, 7 April 2014 (UTC)
C# example
Is it possible to have C# examples on this page as well? Is Java folks and other anti-MSFT folks don't mind.. — Preceding unsigned comment added by 94.237.84.224 (talk) 07:00, 3 February 2015 (UTC)
mysterious words explained
I have been coding for years, and always thought that "mutable" and "immutable" meant something different from simply "changeable" and "unchangeable". Now I am laughing at myself. Why didn't I check those words in a dictionary?
But my story raises a question. Why do we still use these mysterious names? Do these "clever" names make us more clever as programmers or maybe even as humans? ;-)85.193.250.20 (talk) 23:25, 11 February 2016 (UTC)
modifies a pointer an a length filed
Re "modifies a pointer an a length filed" I suspect that filed might be field, but I'm not sure how to correct the "an a" it doesn't make sense to me, but wouldn't make any more sense if changed to "and a". ϢereSpielChequers 11:24, 17 January 2019 (UTC)
What is immutable in JavaScript
Where we should use immutable ?? 115.127.172.50 (talk) 17:31, 16 August 2022 (UTC)
Language-specific details for C
It would be useful to have a section of language-specific details also for C. Jzandin (talk) 13:55, 30 May 2024 (UTC)
ឆ្ងាចអូន
# Git

## Git support
* Bot exporting to external Git repository. For example, Github
* Bot importing from external Git repository
## Requirements
#### 1. Need set Git repository on bot
Go to Bot->Edit-> show Advanced 
or:
Go to Bot -> Tools section -> Git sync

#### 2. Need set Deploy Key on external repository
{% hint style="success" %}
You do not need Deploy Key for read access of public repository 
{% endhint %}
Go to Bot-> Sync in menu, then Git Sync -> Deploy Key show

**Copy Deploy Key**
Now you need set this Deploy Key on external repository.
**Github**
Please see [this](https://developer.github.com/v3/guides/managing-deploy-keys/#deploy-keys). For Git exporting also need "write" access.
#### 3. Now you can make exporting or importing with Git 36.37.198.165 (talk) 22:40, 14 October 2025 (UTC)
Memoization
If it can be turned off by a variable (in the real world, cache gets too big) then is it really immutable? Apples and oranges here? I don't see how memorization is either immutable or mutable. It's a technique not an object, right? A technique or practice in a wide variety of languages that some have little or no (at least explicit) concept of mutability would be hard to think about. It is an interesting viewpoint so we should keep it. It is a rare, wonderful, beautiful evil, I like it. It really gets me thinking. ~2026-38728-73 (talk) 23:49, 31 July 2026 (UTC)
Content Disclaimer
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.
- The information displayed on this website is sourced in part or in whole from Wikipedia and has been adapted for the purpose of restating it. We strive to provide accurate and relevant information, however:
- There is no guarantee of absolute accuracy. Wikipedia is an open, collaborative project that can be edited by anyone, so information is subject to change.
- It is not intended to constitute professional advice. The content displayed is for informational and educational purposes only. For important decisions (e.g., medical, legal, or financial), please consult a professional.
- Content copyright. Wikipedia is licensed under the Creative Commons Attribution-ShareAlike License (CC BY-SA). This means that content may be reused with appropriate attribution and shared under a similar license.
- Responsible use. Any risk arising from the use of information from this website is entirely the responsibility of the user.
