I hate to drag this incredibly interesting yet simultaneously tedious conversation into the realm of the practical but...

Gabriel Sechan wrote:
Seriously, though.  A variable *always* has a type, wether the language does or 
not.  The type of a variable is the kind of data it holds.  This is separate 
from its languae type.  For example, lets say we have to store today's 
temperature.  Its type is temperature in degree's celsius.  Its language type 
may be scalar in perl, int in C++, etc.  But its true type is still temperature 
in degrees celsius.  Having a language that supports typedefs and declarations 
merely documents that for you, rather than forcing you to read the code to 
figure it out.

Can you somehow encapsulate units in a type so that when we program a completely hypothetical Mars lander it doesn't allow us to accidentally mix meters and feet without doing a type conversion? I don't mean just having an integer typecast to "altitude" but somehow call it "altitude in meters" without being so verbose? And for bonus points it would be nice if it could prohibit the involvement of any other units of distance in the calculation so we don't accidentally mix our altitude in meters with our rate of descent in feet per second during our retro-rocket timing calculations.

--
Tracy R Reed                  Read my blog at http://ultraviolet.org
Key fingerprint = D4A8 4860 535C ABF8 BA97  25A6 F4F2 1829 9615 02AD
Non-GPG signed mail gets read only if I can find it among the spam.

--
[email protected]
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-lpsg

Reply via email to