From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 109371 invoked by alias); 3 Dec 2018 02:49:59 -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 109357 invoked by uid 89); 3 Dec 2018 02:49:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=BAYES_00,KAM_NUMSUBJECT,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=H*Ad:U*kawa, engine, HContent-Transfer-Encoding:8bit X-HELO: aibo.runbox.com Received: from aibo.runbox.com (HELO aibo.runbox.com) (91.220.196.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 03 Dec 2018 02:49:57 +0000 Received: from [10.9.9.210] (helo=mailfront10.runbox.com) by mailtransmit02.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1gTeJ0-0000a6-87; Mon, 03 Dec 2018 03:49:54 +0100 Received: by mailfront10.runbox.com with esmtpsa (uid:757155 ) (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) id 1gTeIu-0001FX-DW; Mon, 03 Dec 2018 03:49:48 +0100 Subject: Re: java 11 From: Per Bothner To: daniel szmulewicz , kawa@sourceware.org References: Message-ID: <152a3057-3189-853c-ffa6-0f2ee8b19a62@bothner.com> Date: Mon, 03 Dec 2018 02:49:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-q4/txt/msg00033.txt.bz2 On 12/2/18 5:49 PM, Per Bothner wrote: > On 12/2/18 3:00 PM, daniel szmulewicz wrote: > Your problem may be that you're running the script using load, > or using the -f command-line flag.  That reads, compiles, and evaluates > each line one-by-one which is undesirable for a number of reasons. > For one it hurts various optimizations and requires more reflection. It is possible to get the script running using load or the -f flag, however, run-time method lookup and selection do not work as well as doing it at compile-time, so you want to help the type-inference. The trick is to replace 'define' by 'define-constant' or the '!' short-hand syntax: (define-constant client (*:build (HttpClient:newBuilder))) or: (! client (*:build (HttpClient:newBuilder))) or use an explicit type specifier: (define client ::HttpClient (*:build (HttpClient:newBuilder))) The reason plain define (without a type-specifier) doesn't work is because the Kawa type inference engine can't know if client is *always* an HttpClient - a later set! might change its value. When working file-at-a-time (rather than line-at-a-time) Kawa knows there is no later set!. -- --Per Bothner per@bothner.com http://per.bothner.com/