Hacker News new | past | comments | ask | show | jobs | submit login

Not at all. Simple things like instanceof / typeof checks can be resolved without a static type system. Because with a const everything is known about the const in question. Obviously the const prototype may change but then again if the const has a frozen prototype - that too can have static analysis applied to it.

I am simply repeating the well-known benefits to immutables which is completely orthogonal to a type system, static or otherwise.




instanceof cannot be determined statically because I can do...

    const a = {};
    Object.setPrototypeOf(a, SomethingElse);


really? even on a frozen object?

Remember I have said const PLUS Object.freeze() Both are needed to get the true immutable effect.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: