3 ms·
Pretty sad that computations on types look like C++98 in Typescript when C++ itself has moved on to have much more concise ways of performing computations on ty
by jupp0r 4y ago
Pretty sad that computations on types look like C++98 in Typescript when C++ itself has moved on to have much more concise ways of performing computations on types in C++11 and 14 (see boost hana).
- mmoskal 4y agoInterestingly TypeScript compiler doesn't use types for compilation (that's why you can have esbuild that compiles Typescript without understanding the type system). That is the end result of type computation is... Nothing, always, just like in OP. Template metaprogramming is all about code generation. You would expect them to look different.
- jupp0r 4y agoThe way I think about this is that type computations can be used both for type constraint checking and for code generation. In that sense, C++s template metaprogramming system is a superset of TypeScript's, which can only do checks as you pointed out correctly.