>But I think that misses the point. It's not an issue of a *variable*
>having a value that may be true and may be false, but of a *value*
>being neither true nor false.
>
>Incidedntally, another way of looking at this whole issue is that what
>MUMPS attempts to do is define operators in such a way that they are
>total functions. For example, in most languages
>
>"hello" + 3
>
>would be syntax error, but in MUMPS, "hello"+3 *does* have a value
>(it's 3).
In Javascript it would be "hello3" - "+" is overloaded as the concatenation
operator as
well as the operator for addition. This results in an unfortunate ambiguity as
to the
result of a+b - depending on the values (or rather the types) of a and b.
>IEEE 754 takes this a step further, introducing a new value
>NaN ("Not a Number") to floating point arithmetic, attempting to make
>operators such as division total. But these solutions involve an
>implicit type system, because (in the MUMPS example) "+" becomes
>polymorphic.
MUMPS has a simple and consistent approach to its operators and value type
conversions
between string, number, and logical. I don't think that polymorphic is the
right word for it.
Having only three types of values, MUMPS doesn't need NaN. It is already
consistent.
>Another (IMO, more problematic) issue is this: If we take 0 to mean
>false and non-zerto to mean true, then if x = 1 and y = 2, then we have
>
>x is false
>y is false
>x - 1 is true
>y - 1 is false (!)
>
>so the normal arithmetic operators are not even well-defined over
>Boolean values.
Not a problem! Logical values (booleans) are 1 and 0. 2 is not a logical value.
It will be converted to (or treated the same as) 1 when used in a logical
context.
Your examples are wrong - actually, completely reversed.
---------------------------------------
Jim Self
Systems Architect, Lead Developer
VMTH Computer Services, UC Davis
(http://www.vmth.ucdavis.edu/us/jaself)
-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
Hardhats-members mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hardhats-members