From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70777 invoked by alias); 3 Apr 2015 05:07:54 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 70768 invoked by uid 89); 3 Apr 2015 05:07:53 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mail.theptrgroup.com Received: from mail.theptrgroup.com (HELO mail.theptrgroup.com) (71.178.251.9) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 03 Apr 2015 05:07:52 +0000 Received: from [10.11.21.42] (unknown [10.11.21.42]) by mail.theptrgroup.com (Postfix) with ESMTPS id 9E187E08EC for ; Fri, 3 Apr 2015 01:07:50 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) Subject: Re: #t and #f now default to primitive types From: Jamison Hope In-Reply-To: <551DEC76.3010001@bothner.com> Date: Fri, 03 Apr 2015 05:07:00 -0000 Content-Transfer-Encoding: 7bit Message-Id: References: <551DEC76.3010001@bothner.com> To: "kawa@sourceware.org list" X-IsSubscribed: yes X-SW-Source: 2015-q2/txt/msg00001.txt.bz2 On Apr 2, 2015, at 9:27 PM, Per Bothner 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. I still find the type inferencing to be a bit mysterious, I guess the actual return type of the neg function isn't always being queried when the IfExp's type is calculated? -- Jamison Hope The PTR Group www.theptrgroup.com