This is the mail archive of the mailing list for the Kawa project. See the Kawa home page for more information.

[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index] [Subject Index] [Author Index] [Thread Index]

Re: type specifiers for local variables

At 12:09 PM 3/11/99 -0800, Per Bothner wrote:
>One option is to use extra parentheses:
>	(let (((i <int>) 10)) ...)

That to me is the best form as it is most in keeping with LISP syntax.

I believe though that it should be:

	(let (((<int> i) 10)) ...)

Putting the type specifier first keeps the parsing unambiguous and avoids
potential conflict with other forms.

The thing that I most want to see along these lines is the ability to have
seamless use of Java classes:

	(let (((<java.util.Vector> v) ((<java.util.Vector> new <int>) 100)))
            ((v addElement <object>) "foo")

Of course it would be even nicer if the compiler can disambiguate the
parameter types and pick the proper method.

OTOH, what about aligning this feature with Common Lisp syntax:

     (let ((x 10) (y 20) ...) 
          (declare (type integer x y) ...)

Kawa's <typename> form would also permit:

     (let ((x 10) ...) 
          (declare (<integer> x) ...)

Note that Common Lisp sez that this means that *both* x's are integer:

     (define (foo x)
          (declare (<integer> x))
          (let ((x 10)) ...))

Common Lisp also has the 'the' form for asserting the type of values which
is probably a necessary thing (it would work with the method disambiguation
for example).

I also wonder whether it is worthwhile to try and harmonize this feature
with CLOS, at least so far as syntax where functionality is common.

James P. White                 Netscape DevEdge Champion for IFC 
IFC Exchange   *   Insanely great Java   * Pagesmiths' home is