Tracy R Reed wrote:
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?

Yes. C++ can do this with great template tedium. Ada can do this directly in the language, I believe.

Any language which allows you to provide an assignment operator along with an opaque type can do this.

However, it still doesn't help if someone transcribes the data wrong.

You really need a functional test to catch this one.

-a

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

Reply via email to