This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

importing java packages


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]