Download Firefox: WindowsMac OS X
logo       
Google Custom Search
    AddThis Social Bookmark Button

Quantities are Singletons?: msg#00000

Subject: Quantities are Singletons?
In Quantity.java (SISC 1.8.8), we have:

    public Value singletonValue() {
        return this;
    }

And in the interpreter I get:

#;> (= 5 5)
#t
#;> (eq? 5 5)
#f
#;> (eqv? 5 5)
#t
#;>

So it would appear that quantities don't truly follow the contract for
Singleton.  Perhaps they were meant to be true singletons but that feature
has never been implemented?  A quick perusal of R5RS 6.1 suggests that
this behaviour is legal R5RS so maybe the fix is simply to remove the
"implements Singleton" from the top of Quantity.java.

Note however the following:

#;> (equal? 5 5.0)
#t
#;> (eqv? 5 5.0)
#f
#;>

Is the result for equal? not a bug?  R5RS defines equal? as recursively
processing pairs, vectors, and string, using eqv? to compare things like
numbers.

Isaac Morland                   CSCF Web Guru
DC 3147, x6650                  WWW Software Specialist


-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 - 
digital self defense, top technical experts, no vendor pitches, 
unmatched networking opportunities. Visit www.blackhat.com


<Prev in Thread] Current Thread [Next in Thread>