What would a “frozen dict” be?
A frozen set is a frozenset.
A frozen list could be a tuple.
What would a frozen dict be? An immutable, hashable dict.
I guess it could be something like collections.namedtuple, but that is …
Technical knowledge for tech readers and developers
immutability
A frozen set is a frozenset.
A frozen list could be a tuple.
What would a frozen dict be? An immutable, hashable dict.
I guess it could be something like collections.namedtuple, but that is …
What’s the difference between:
class Person(name: String, age: Int) {
def say = “My name is ” + name + “, age ” + age
}
and
class Person(val name: String, val age: Int) {
def say = “My name is …
As we all know, strings in .NET are immutable. (Well, not 100% totally immutable, but immutable by design and used as such by any reasonable person, anyway.)
This makes it basically OK that, for …
Why isn’t it possible to have this:
def main(args:Array[String]) {
val whatever:String // Have it uninitialized here
if(someCondition) {
whatever = “final value” // Initialize it …
I am looking for an idiomatic solution to this problem.
I am building a val Scala (immutable) Map and would like to optionally add one or more items:
val aMap =
Map(key1 -> value1,
key2 -&…
I know that java.lang.String class is declared as final for security and performance related reasons.
What I’m not understanding is the part that whether same purpose could be achieved using all …
Have the following class:
public class Member {
private int x;
private long y;
private double d;
public Member(int x, long y, double d) {
this.x = x;
this.y = y;
this.d = d;
}
@Override
…
While building a large multi threaded application for the financial services industry, I utilized immutable classes and an Actor model for workflow everywhere I could. I’m pretty pleased with the …
Given that mutable structs are generally regarded as evil (e.g., Why are mutable structs “evil”?), are there potential benefits that might have prompted the designers of the .NET framework to make …
So far most of “starter boilerplates” and some posts about react / redux I’ve seen encourage usage of immutable.js to address mutability. I personally rely on Object.assign or spread operators to …