* improved import syntax
@ 2015-09-29 23:15 Per Bothner
0 siblings, 0 replies; only message in thread
From: Per Bothner @ 2015-09-29 23:15 UTC (permalink / raw)
To: mikel evins, Kawa mailing list
In an import form, you can now use a classname (ie. a symbol usually
with dots), instead of a list. I.e.:
(import org.example.Foo)
is equivalent to:
(import (org example Foo))
I don't remember if I announced the import-class form, but it's quite handy:
You can import multiple class from the same package with duplication:
(import (class java.util Map HashMap))
You can also rename it:
(import (class java.lang (StringBuilder StrBuf)))
The above is equivalent to:
(define-alias StrBuf java.lang.StringBuilder)
but with import-class you can import (and optionally rename) many classes
in a compact form.
You can combine the class clause with import's only, except, rename, and prefix clauses,
though only prefix is likely to be useful. For example:
(import (prefix (class java.lang Long Short) jl-))
is equivalent to
(import (class java.lang (Long jl-Long) (Short jl-Short)))
--
--Per Bothner
per@bothner.com http://per.bothner.com/
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-09-29 23:15 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-29 23:15 improved import syntax Per Bothner
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).