This is the mail archive of the
kawa@sourceware.org
mailing list for the Kawa project.
Re: rough support for parameterized types in Kawa
- From: Helmut Eller <eller dot helmut at gmail dot com>
- To: kawa at sources dot redhat dot com
- Date: Mon, 25 Jul 2011 10:58:35 +0200
- Subject: Re: rough support for parameterized types in Kawa
- References: <4E0BD142.7060104@bothner.com>
* Per Bothner [2011-06-30 01:28] writes:
> I just checked in some support for parameterized types in Kawa.
>
> The syntax is (as discussed before):
> Type[Arg1 Arg2 ... ArgN]
> which is more-or-less equivalent to Java's:
> Type<Arg1, Arg2, ..., ArgN>
>
> There are a number of limitations and no-doubt bugs:
> - For now Type has to be a native Java class/interface-name
> (like gnu.lists.FVector) and cannot be a Kawa type-alias (like vector).
> - No support for wildcards - I haven't figured those out yet.
> - No way to declare parameterized classes or methods - only usage.
> - No support for parameterized methods - only classes.
> - No doubt other bugs or other things that doesn't work as it should.
>
> However, it's not completely shabby. For example Kawa can figure out that
> the return type of this function is java.lang.Integer:
>
> (define (get-from-vector x::gnu.lists.FVector[java.lang.Integer] i::int)
> (x i))
>
> Kawa can figure out parameterized types and type-variables of existing
> class and methods (using reflection).
>
> Kawa can also write out "Signature" attributes that let the JVM and
> compilers
> (including javac) re-create the correct signatures.
>
> This is another step in my nefarious plan to provide better performance
> and compile-time type-checking to Kawa.
Can we expect function types anytime soon?
I'd like to write something like
(define (foo f::(function object -> int) x)::int
(f x))
Ideally this would work without boxing.
Helmut