News for hackers. Stuff that matters.
Re:The broken promise of Web Components by comex on Thursday March 16, 2017 @05:48PM (#13889522)
To clarify, by "literal that must exist or it throws" you mean that you don't know whether the class you're testing for exists? Testing against an invalid class would be an error in most languages…

I guess an alternative is foo.constructor and foo.constructor.name, which will give you a string if you want that.

Re:The broken promise of Web Components by kbenson on Friday March 17, 2017 @04:24AM (#13892403)
Since many different js libraries may be loaded from many different sources, I could envision a situation where some utility functions may want to support different inputs depending on what's passed in, and what's passed in might depend on what's loaded, and what's loaded can change at runtime.

That's why many dynamic languages allow access to the type through a string representation.