▲ | spankalee 3 days ago | |
It is absolutely true that it is unsafe to trust TypeScript types. I've chatted briefly with Oliver on socials before and he knows this. So I am a bit confused by this issue: https://github.com/CanadaHonk/porffor/issues/234 which says "presume the types are good and have been validated by the user before compiling". This is just not a thing that's possible. Types are often wrong in subtle ways. Casts throw everything out the window. Dart had very similar issues and constraints and they couldn't do a proper AOT compiler that considered types until they made the type system sound. TypeScript can never do that and maintain compatibility with JS. Isolates are already available as workers. The key thing is that you can't have shared memory, other wise you can get cross-Isolate references and have all the synchronization problems of threads. And ECMAScript is simply just specified as a single-threaded language. You break it with shared-memory threads. In JS, this always logs '4'. With threads that's not always the case.
| ||
▲ | nicoburns 3 days ago | parent [-] | |
> It is absolutely true that it is unsafe to trust TypeScript types... This is just not a thing that's possible. Well... unsafe and impossible aren't quite the same thing. I guess this is possible if you throw out "safe" as a requirement? |