This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
importing java packages
- From: Steve Yegge <steve dot yegge at gmail dot com>
- To: kawa at sources dot redhat dot com
- Date: Wed, 16 Mar 2005 21:26:37 -0800
- Subject: importing java packages
- Reply-to: Steve Yegge <steve dot yegge at gmail dot com>
Feature request for your consideration: import-java-package
(import-java-package <java.awt>)
(import-java-package <javax.swing>)
;; e.g.:
(let* ((f (make <JFrame>))
(root :: <Container> (invoke f 'getContentPane)))
(invoke root 'setLayout <BorderLayout>)
(invoke root 'add
(make <JLabel> "hello")
(static-field <BorderLayout> 'CENTER)))
This would be exceptionally convenient for apps that make heavy
use of the Java APIs. By importing a java package, all the names
from that package become available as types.
The compiler would make you resolve ambiguities. The canonical
example (this is a problem in all JVM languages) is importing java.awt.*
and java.util.* -- "List" could be either java.awt.List or java.util.List.
In Kawa's case, you don't need the single-class import, because
define-alias already works nicely for those cases.
Thoughts?
-steve