(no title)
frenchy | 1 year ago
That's not quite true. Branding doesn't exist at run time, where as nominal typing usually does at some level. Classes exist at runtime, but most typescript types don't, so unless there's something specific about the shape of the data that you can check with a type guard, it's impossible to narrow the type.
deredede|1 year ago
Not necessarily, depending on the language. Functional languages and system languages such as OCaml, Haskell, Rust, but also C (painfully) and C++ can represent wrapper types within a nominal type system at no runtime cost.
nequo|1 year ago
https://okmij.org/ftp/Computation/typeclass.html#dict
In Rust, using trait objects also generates a vtable for dynamic dispatch so in that case traits are not fully erased:
https://web.mit.edu/rust-lang_v1.25/arch/amd64_ubuntu1404/sh...
garethrowlands|1 year ago