From: Per Bothner <per@bothner.com>
To: daniel szmulewicz <daniel.szmulewicz@gmail.com>, kawa@sourceware.org
Subject: Re: java 11
Date: Mon, 03 Dec 2018 02:49:00 -0000 [thread overview]
Message-ID: <152a3057-3189-853c-ffa6-0f2ee8b19a62@bothner.com> (raw)
In-Reply-To: <e7264f03-56e4-f54c-a099-cfe940cf9070@bothner.com>
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/
prev parent reply other threads:[~2018-12-03 2:49 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-02 23:01 daniel szmulewicz
2018-12-03 1:50 ` Per Bothner
2018-12-03 2:49 ` Per Bothner [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=152a3057-3189-853c-ffa6-0f2ee8b19a62@bothner.com \
--to=per@bothner.com \
--cc=daniel.szmulewicz@gmail.com \
--cc=kawa@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).