Hacker News new | past | comments | ask | show | jobs | submit login

Then "unitIntervalValue"



Right. That's the thing we need a word for :)

Unit Interval Value is nice but still a bit cumbersome. I mean if we all agreed right now it were called a "poog" then we could just say poog.


UnitInterval is the type. The name of the value should reflect its specific use.


Exactly. The best usage for this would be something like:

    typedef float UnitInterval;

    void do_something_accurately(UnitInterval accuracy);


It's still not really "correct" IMO, I think it needs to be "UnitIntervalValue" as someone said above. I'd expect that things of type "UnitInterval" would be intervals, not values. "UnitInterval" would be like calling the type "Int32Range" instead of "Int32".

(NB: "In real life" I would never "correct" someone for calling it "UnitInterval", it's good enough -- but given this is a pure discussion of semantics...)


Sure, that's fair. I was more talking about it being better to name the type a particular thing, rather than encoding the type in the variable name.


This is the correct answer IMHO. (The variable name could also be "proportion" or "probability" depending on context, and the type name could more precisely be ClosedUnitInterval, but the idea of putting it in the type is IMHO correct.)

I don't know much about C (? I assume that's what this is), but in other languages you can even build a wrapper type and enforce invariants in construction if really necessary.

Of course, all that ceremony only makes sense if this is really a type you use multiple times. Otherwise I wouldn't bother.


ClosedUnitInterval surely describes the interval itself, not a member of that interval. The member would be ClosedUnitIntervalValue or something. This is the thing it would be nice to have a short name for.

Just as we say an integer is a member of the set called the integers.

We say our "X" (the word we are looking for) is a member of the set called the closed unit interval.


    typedef float UnitIntervalValue;

    void do_something_accurately(UnitIntervalValue accuracy);
FTFY


UnitInterval isn't a type, it's a value of type Range, specifically the range [0,1].

UnitIntervalValue would be the type name for the thing we are interested in.

Values of that type should of course have descriptive names.




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: