Re:A word for a value between 0 and 1 (inclusive)
by _ezkx on Friday September 04, 2020 @10:54AM
(#24375458)
I think this is right, but it's still IMO basically a natural language semantics issue. For instance in haskell (which has a pretty advanced static type system), I would still probably be satisfied with:
-- A float between 0 and 1, inclusive.
type UnitInterval = Float
foo :: UnitInterval -> SomeResultPresumably
foo accuracy = ...
i.e. I think the essential problem in the SO question is solved, even though we have no additional type safety.
A language without type synonyms could do just as well with CPP defines
A language without type synonyms could do just as well with CPP defines