Why "unit"?
Raphael Collet
raph at info.ucl.ac.be
Wed Jan 25 18:05:27 CET 2006
Harmon Nine wrote:
> Why is “unit” (as opposed to, say, “frozboz”) the non-descript value to
> bind a variable to when any atom would do? Is there a history behind
> this, e.g. was it taken from another language?
I am not sure, but I think it first appeared in functional languages.
Functions that do some side effects, but don't return a result, just
return "unit". It is used as a value with no semantics.
The name "unit" comes from the fact that the type of "unit" only has one
possible value. If you write the type Unit as a set of values, you have
Unit={unit}.
Cheers,
raph
More information about the mozart-users
mailing list