From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56866 invoked by alias); 29 Sep 2015 23:15:28 -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 56851 invoked by uid 89); 29 Sep 2015 23:15:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_05,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 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 (AES256-SHA encrypted) ESMTPS; Tue, 29 Sep 2015 23:15:26 +0000 Received: from [10.9.9.207] (helo=mailfront03.runbox.com) by bars.runbox.com with esmtp (Exim 4.71) (envelope-from ) id 1Zh47G-0006Eu-4d; Wed, 30 Sep 2015 01:15:22 +0200 Received: from 70-36-239-58.dsl.dynamic.fusionbroadband.com ([70.36.239.58] helo=toshie.bothner.com) by mailfront03.runbox.com with esmtpsa (uid:757155 ) (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.76) id 1Zh47B-00069O-At; Wed, 30 Sep 2015 01:15:17 +0200 To: mikel evins , Kawa mailing list From: Per Bothner Subject: improved import syntax Message-ID: <560B1B80.8010103@bothner.com> Date: Tue, 29 Sep 2015 23:15:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-q3/txt/msg00093.txt.bz2 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/