Points about language support for 292
forax at univ-mlv.fr
Fri May 1 05:57:54 PDT 2009
Alex Buckley a écrit :
> Neal Gafter wrote:
>> On Thu, Apr 30, 2009 at 3:15 PM, Alex Buckley <Alex.Buckley at sun.com
>> <mailto:Alex.Buckley at sun.com>> wrote:
>> Neal: InvokeDynamic IS now a reference type. Regarding <..> to indicate
>> return type for a dynamic call site, how does C# denote that?
>> It doesn't. A dynamic invocation, from the point of view of C#, returns
>> a value of type dynamic. The hoped-for return type isn't encoded into
>> the invocation.
> The utility of a Dynamic type is high. The utility of values of Dynamic
> type is not high, in my view. Coin's support for 292 is limited, and
> does not include general manipulation of non-Java objects in the Java
> language. I respect that you believe the time has come for general
> manipulation of non-C# objects in the C# language.
even if I think that language developers should eat their own dog food.
Question: why do we need to use a type InvokeDynamic ?
The invokedynamic instruction is a function call,
so I propose to use a syntax more close to a function call,
Now, the problem of the return type.
I propose the following rules:
- if the dynamic call is the righ part of an assignation, the return type
is the type of the lhs.
int value = $aDynamicFunction(param1, param2) // -> int
- if the dynamic call is prefixed by a cast, the return type is the
type of the cast (note that this rule doesn't exist for generics)
(double)$aDynamicFunction(param1, param2) // -> double
- else the return type is Object.
More information about the coin-dev