Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I've seen this paradigm called "Tiny Types" before: http://darrenhobbs.com/2007/04/11/tiny-types/


I'm actually surprised that people learn about this only now... It is quite standard (and very common) thing to do in Ada. But then we can "subtype Strength is Natural range Natural'First .. 32;" since 80s (numeric type with all operators defined with permitted range of values from 0 to 32; range checks are performed at runtime by compiler - but most of them are optimized out anyway so penalty for them is in single digit percents of performance). Or if you prefer example from that site: "type First_Name is new String;"




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: