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

As long as you tell the typescript compiler not to stop when it finds type problems, all JavaScript works and compiles, right? That sounds like a superset to me. Syntactically there are no problems, and the error messages are just messages.



> As long as you tell the typescript compiler not to stop when it finds type problems, all JavaScript works and compiles, right?

Does such code count as valid TypeScript though? It sounds more as if the compiler has an option to accept certain invalid programs.

You could build a C++ compiler with a flag to warn, rather than error, on encountering implicit conversions that are forbidden by the C++ standard. The language the compiler is accepting would then no longer be standard C++, but a superset. (Same for all compiler-specific extensions of course.)

Personally I'm inclined to agree with this StackOverflow comment. [0] It's an interesting edge-case though.

[0] https://stackoverflow.com/questions/29918324/is-typescript-r...


It's syntactically and functionally correct, so despite the error messages I think 'valid' is a better label.

> You could build a C++ compiler with a flag to warn, rather than error, on encountering implicit conversions that are forbidden by the C++ standard. The language the compiler is accepting would then no longer be standard C++, but a superset. (Same for all compiler-specific extensions of course.)

The way I see it, these errors are already on par with C++ warnings. C++ won't stop you if you make a pointer null or use the wrong string as a map key.




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

Search: