3 ms·
> their representation doesn't take up any space. One of the way to represent them doesn't take up any space. But if you want to e.g. have a generic function o
by Joker_vD 2y ago
> their representation doesn't take up any space.
One of the way to represent them doesn't take up any space. But if you want to e.g. have a generic function of e.g. (T,U,V) -> V type (that is, with no monomorphization in your compiler) then either your units have to take space (otherwise the layout of (unit,int,bool) is different from (int,int,bool) and the same), or you'll have to pass around type descriptors when invoking generic functions. Which many, many implementors of static languages rather wouldn't do unless absolutely necessary.
- lmm 2y ago> if you want to e.g. have a generic function of e.g. (T,U,V) -> V type (that is, with no monomorphization in your compiler) then either your units have to take space (otherwise the layout of (unit,int,bool) is different from (int,int,bool) and the same), or you'll have to pass around type descriptors when invoking generic functions. You have that problem already though surely, as T might be bigger than an int, or want to be passed in a floating-point register, or both.