On Apr 2, 2015, at 9:27 PM, Per Bothner <per@bothner.com> wrote:
The literals #t and #f are now treated as having primitive boolean types,
rather than java.lang.Boolean type. That is the return type of:
(define (neg x) (if (>= x 0) #f #t))
is boolean rather than java.lang.Boolean.
Of course you can specify Boolean explicitly if you want:
(define (neg x) ::java.lang.Boolean (if (>= x 0) #f #t))
Thanks, Per. I find it curious that with neg defined as above
(returning primitive boolean), these return what they do:
(define (f a b) (and (neg a) (neg b)))
(define (g a b) (if (neg a) (neg b) #t))
(define (h a b) (or (neg a) (neg b)))
(define (i a b) (if (neg a) #t (neg b)))
If everything is compiled all together in a module, f and g return
java.lang.Boolean, h and i return primitive boolean.
In the REPL, defining neg and then defining each of those four
functions, they all return java.lang.Object.