5 ms·
Seems like you entirely missed the “as comments” part. In the current proposal at least, the type annotations are just comments that can not change runtime sema
by justshowpost 5y ago
Seems like you entirely missed the “as comments” part. In the current proposal at least, the type annotations are just comments that can not change runtime semantics.
- 015a 5y agoNo. They still need to be interpreted at runtime in unminified code, in order to determine that they are comments. This carries a cost; performance, sure, but more importantly it locks in a SWEEPING complex syntax change for decades which limits future language changes and significantly complicates the parser. The fact that they by design have no impact on the runtime isn't really even a positive. That could be a large tactile benefit of this RFC; that suddenly JS is capable of communicating to its runtime what types different primitives are, such that the runtime can optimize their storage and usage. But, by design, they don't want this. Maybe that could change in the future, but I suspect it won't because the proposers have taken the stance that everyone minifies anyway so the syntax doesn't matter anymore.