This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: The nature of truth
Jim White wrote:
Those are just the two changes I had in mind, but didn't have time to
track down where they went. With those changes Kawa is entirely
consistent with itself (and sensible Java practice). It is easy to see
why boolean? appears to map to 'instance? <java.lang.Boolean>', but for
the reasons already discussed, that relationship doesn't hold.
The question is: What should standard Scheme functions do on values
that are proper Scheme values? And more specifically what should Scheme
type predicates do?
Consider (symbol? x). It is implemented as (instance? x
<java.lang.String>). However, that returns true for non-interned
Strings, which are not standard Scheme symbols. Should we change
(symbol? x) to (and (instance? x <java.lang.String>) (eq? x (invoke x
'intern))? We could so that, but it's less efficient, and the existing
implementation is reaonable as an "uninterned symbols" extensions.
I don't see any reason for Chris's change to DisplayFormat.writeObject.
What if the parameter is a non-canonical boolean? We have to do
something with them. "Coercing" them to boolean may not be 100%
consistent, but you're not going to get 100% consistency if you use
non-canonical booleans, and the existing behavior seems as good a choice
as any.
The change to boolean? is more plausible. The performance difference is
minor, and given that in Scheme any value can be used as a boolean, it
may be reasonable to defined boolean? as testing for "canonical boolean".
--
--Per Bothner
per@bothner.com http://per.bothner.com/