2 ms·
I don't think having to use .get() for property access is equatable to "readable names". It is also not the reason for this in the library you mentioned AFAIK,
by moritzwarhier 3y ago
I don't think having to use .get() for property access is equatable to "readable names". It is also not the reason for this in the library you mentioned AFAIK, although I haven't used it so far. I think the reason for the .get() is that it is not achievable to have deep immutability in JS with regular property access (Object.freeze is not "deep" either).
That aside, I agree it's not ergonomic, but it has nothing to do with readable names.
And converting a string to an integer is not possible with a native JS operator intended for this purpose, so I'd prefer Math.trunc any day.
Regarding the immutable.js thing, the Records/Tuples TC39 proposal aims for a syntax and runtime addition to allow immutable objects with regular dot property access.