Skip to content

Comment on The abject failure of weak typing

Comments

I'd like to stress the point about wrapper types, which can even be usefully employed in C. Note that - in C - this is not typedef (which is mostly cosmetic), but rather wrapping primitives in otherwise empty structs. This has no runtime cost and has the tremendous benefit that you won't mix up the arguments to place_order(price_t, quantity_t) where you might to place_order(int price, int quantity).

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.