PROPOSAL: language support for JSR 292

Neal Gafter neal at gafter.com
Wed Apr 29 20:14:44 PDT 2009


These proposals appears to allow primitives and "void" to be used as generic
type arguments for this special class.  This use of the syntax has nothing
to do with generics.  Therefore, I believe it is an abuse of syntax.

If you're going to extend the language to support this special InvokeDynamic
class, you might as well just define language support for dynamic
invocations directly without the magic class and generic extensions.  I
don't think the current spec for Dynamic fits with the current type system.
If you are adding special types like InvokeDynamic, I think they must be
reference types (i.e. a subtype of Object).  You should try to get some
information about what C# has done in this area for "dynamic", as I believe
it could be applied to Java and result in a clean solution.

By the way, now is a good time to add the boxed "Null" type, which has no
instances, referring to the type of null.  I don't think this purpose is
well served by using java.lang.Void.

On Wed, Apr 29, 2009 at 7:37 PM, John Rose <John.Rose at sun.com> wrote:

> I have factored out the Dynamic type from the proposal, leaving a
> static-only type called InvokeDynamic in its place.  Here is the updated
> spec (also enclosed FTR):
>  http://wikis.sun.com/display/mlvm/ProjectCoinProposal
>
> The type java.dyn.InvokeDynamic is a uninstatiable class (like Collections
> or Arrays) with no apparent methods. However, the compiler treats it has if
> it had an infinite supply of static methods of all names and signatures, for
> which it generates invokedynamic instructions instead of invokestatic
> instructions.
>
> By removing the value type Dynamic from the base proposal, we serve the
> immediate need for system programming on top of JSR 292, while deferring the
> question (a truly absorbing and important question) of integrating dynamic
> values with Java's type system.
>
> -- John
>
> P.S.  The factored-out parts, about interface Dynamic and its interesting
> rules for conversion and method invocation, are placed here:
>  http://wikis.sun.com/display/mlvm/InterfaceDynamic
>
> And, should you have an appetite for even more of the same, some rough
> notes a fuller integration of Java with dynamic types is here:
>  http://wikis.sun.com/display/mlvm/DynamicJava
>
> P.P.S. Here is a text-only copy of the basic proposal:
>
>
>
>
>
>
>



More information about the coin-dev mailing list