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

"accessing missing properties throws" will just lead to a lot of use of try/catch, and the issues that entails. It's frankly doubtful whether it will speed things up at all, if there is any penalty to throwing try/catch everywhere.



That won't be a problem in SoundScript though, because any code which tries to access a property which might be missing is unsound, so it won't "compile" (or rather, it won't pass the type checker).


In order for this to work, the type needs to be statically known, which in turn means type casts would be required when asserting a downcast.

Javascript littered with casts is nothing I want to see. I don't know about you.


or you can check first with .hasOwnProperty() or with the in operator


if the client supports .hasOwnProperty() or the 'in' operator ...

(it's just a few years that these were not common, and there are still clients around that don't support it)


Got any examples of these browsers? IIRC i used hasOwnProperty as far back as IE6.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

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

Search: