Most voted "immutability" questions
Immutability is the inability to modify data after it has been created. Modifications are made by copying data. The immutable data property is that it is *referentially transparent*.
Learn more…16 questions
Sort by count of
-
76
votes3
answers5608
viewsWhat does "immutable" really mean?
In that question I did about value types and reference types in C#, it was quoted in the accepted answer that instances of structs must be immutable objects. Reading on wikipedia confirmed that an…
-
28
votes1
answer1626
viewsWhat is Flyweight Pattern?
Researching a little to better understand the logic that leads strings in Java to be immutable, I found out that "internment" of Strings is an example of the pattern Flyweight. In accordance with…
pattern-design software-engineering memory-management immutability flyweightasked 8 years, 1 month ago Anthony Accioly 20,516 -
16
votes1
answer1022
viewsThe use of immutability
Immutability What are the advantages and benefits, when to use and why to use immutability in my projects? The complexity of the implementation x time, worth it? When I should not use immutability…
-
14
votes2
answers817
viewsHow to create an immutable object in Javascript?
I know it is possible to "freeze" a Javascript object through the method Object.freeze: var x = { foo:"bar", complexo:[1,2,3] }; Object.freeze(x); x.foo = "baz"; // Não tem efeito…
-
13
votes1
answer443
viewsIs an immutable Enummap thread safe?
An immutable map built on top of a EnumMap could be used in multi-thread environment or there is some risk of competition problems? public enum MyEnum { VALUE1, VALUE2, VALUE3, VALUE4; } private…
-
10
votes1
answer4428
viewsWhat’s the difference in Kotlin between var and val?
Learning Kotlin I came across the following doubt, according to the documentation: Classes in Kotlin can have properties. These can be declared as mutable, using the var keyword or read-only using…
-
6
votes2
answers229
viewsIf Python strings are immutable, how can we change them with the replace() method?
If Python strings are immutable, how can we change them with the method replace(), for example? Ex: s = "banana" s = s.replace("b", "z") print(s) # zanana Is this a change of the original string or…
-
4
votes2
answers1117
viewsHow do I return a new instance of the python class itself dynamically inside it?
I’m giving a study in Python and for this I am building a class in Python that I had already done in PHP. For example, in a given method in PHP I needed to return the same instance of the class,…
-
3
votes1
answer93
viewsWhat exactly is the Datetime::createFromImmutable() method for?
What exactly is the method for DateTime::createFromImmutable()? Implemented according to the release note of version 7.3.0 of PHP.
-
3
votes1
answer89
viewsIs it possible to apply or simulate immutability to an "object" of the Map type in Javascript?
For objects, we can leave it unchanged, so trying to re-assign a new value to a property, adding new properties, or removing properties is not possible. Of course, in case the object suffered…
-
3
votes2
answers144
viewsWhat are the differences between constants declared with const and immutable variables declared with Let in Rust?
The declaration of immutable variables In Rust if you want to declare a variable, we use the keyword let. Example: fn main() { let site_name = "Stack Overflow em Português";…
-
2
votes2
answers190
viewsWhy is it possible to change constant values in Javascript arrays?
Having the following code: const arr = [1,2,3]; console.log(arr); arr.push(4); console.log(arr); arr.pop(); console.log(arr); arr shouldn’t it be constant? And therefore shouldn’t accept the method…
-
2
votes1
answer33
viewsImmutability in the angular components
Hello, I am learning functional programming and would like to know how to apply the principle of immutability in the angular components. For example, in the case below I have a list of files that…
-
1
votes1
answer3392
viewsAdding character to a string
Good person my doubt and the next, I have the following situation: i have the following variable >>> a = "EXAMPLE" Let’s assume I had to remove the letter "M" right string, in this case I…
-
1
votes0
answers78
viewsMethods that return constant values in C and C++ even if they come from variables, is it possible?
In a series of optimizations in a code written in C++ adopted a class to store application parameterization data and some pseuconstants let’s say so. What actually happens is that when the…
-
1
votes1
answer162
viewsStructure in "tree", how to iterate on it?
Look at the picture: I’m trying to clone a page using the concepts of immutable. Each page has some features and the feature I must prepare before saving the page in the state(state) is "localId" By…