|
|
|
|
|
by wruza
2309 days ago
|
|
>this worked fine with Typescript as long as nobody accidentally introduced a wrong class The problem with receiving a wrong class is not intrinsic to any particular type system: A *a = reinterpret_cast<A*> &a;
// have a nice gdb day
C++ doesn’t control types at runtime too, it is just bytes (runtime data) at precompiled offsets. Either you cook types wrong, or that data is designed as a set of untagged unions that get in the way of any typing, forcing to any-cast everywhere. <any> is for unknown pojos, not for already-typed values. And even if Foo is passed to makeBar(arg:any):Bar, it should treat it as pojo and still emit Bar as a result, not just ‘arg’ as it is. All typed languages do exactly the same for incoming binary data, the only difference is that you have pojos instead of byte-ptrs.>Typescript doesn't really add what it's supposed to add. Underspecified/force-casted types couldn’t help with these promises. It is like programming in C with a heavy preference to void pointers and va_lists. |
|