public inbox for kawa@sourceware.org
 help / color / mirror / Atom feed
From: Per Bothner <per@bothner.com>
To: mikel evins <mevins@me.com>, Kawa mailing list <kawa@sourceware.org>
Subject: improved import syntax
Date: Tue, 29 Sep 2015 23:15:00 -0000	[thread overview]
Message-ID: <560B1B80.8010103@bothner.com> (raw)

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/

                 reply	other threads:[~2015-09-29 23:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=560B1B80.8010103@bothner.com \
    --to=per@bothner.com \
    --cc=kawa@sourceware.org \
    --cc=mevins@me.com \
    /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).