Questions tagged as 'imutabilidade'

2
answers

How to create an immutable object in JavaScript?

I know that it is possible to "freeze" an object in JavaScript using the Object.freeze method: var x = { foo:"bar", complexo:[1,2,3] }; Object.freeze(x); x.foo = "baz"; // Não tem efeito console.log(x.foo); // bar However, the comple...
asked by 18.02.2014 / 02:09
1
answer

What is the difference in Kotlin between var and val?

Learning Kotlin I came across the following question, according to the documentation:    Classes in Kotlin can have properties. These can be declared as   mutable, using the var keyword or read-only using the val keyword. Classes in Kotl...
asked by 27.07.2017 / 17:40
2
answers

How do I return a new instance of the python class itself dynamically inside it?

I am giving a study in Python and for this I am putting together a Python class 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 dynamically, but without usi...
asked by 18.05.2016 / 20:32
1
answer

What exactly does the DateTime :: createFromImmutable () method serve?

What exactly is the DateTime::createFromImmutable() method for? Implemented according to release note of PHP version 7.3.0.     
asked by 21.12.2018 / 02:36
1
answer

Why 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); How much of% should not be constant? And why should not you accept the method arr and push() ? After...
asked by 24.01.2018 / 13:55
1
answer

Adding character to string

Good person my doubt and the following, I have the following situation: I have the following variable >>> a = "EXAMPLE" Let's suppose I had to remove the letter "M" from the string, in this case I would do >>> a = a.r...
asked by 29.12.2015 / 04:38
1
answer

Structure in "tree", how to iterate over it?

Look at the image: I'mtryingtocloneapageusingimmutableconcepts.EachpagehassomecharacteristicsandthecharacteristicthatImustpreparebeforesavingthepageinthestateisthe"localId" By clicking the "clone" link the following code is called: expo...
asked by 21.11.2016 / 14:01
0
answers

Methods 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 ++ I adopted a class to store data of parameterization of the application and some pseuconstantes let's say so. What actually happens is that when the application initializes it gets all par...
asked by 15.10.2016 / 11:29