Re: Duby dynamic dispatch has landed!

2010-04-05 Thread John Rose
FTR, there's a good smoke test for the method handles part of JSR 292 in the JDK sources: davinci/sources/jdk/test/java/dyn/MethodHandlesTest.java Running the test requires JUnit 4.5. $JSR292_JAVA_HOME/bin/java -ea -esa -XX:+{UnlockExperimentalVMOptions,EnableMethodHandles}

Re: Duby dynamic dispatch has landed!

2010-04-05 Thread John Rose
The sources are changing rapidly at this point; I'm working on invokeGeneric. If you send me a JAR which which can run stand-alone, I can use it as a regression test. -- John On Apr 2, 2010, at 2:36 PM, Attila Szegedi wrote: On 2010.03.25., at 3:17, Charles Oliver Nutter wrote: For

Re: Duby dynamic dispatch has landed!

2010-04-04 Thread Stephen Bannasch
At 10:41 PM +0200 4/2/10, Attila Szegedi wrote: So I decided to throw in the towel, and use Stephen Bannasch's excellent update.sh fromhttp://gist.github.com/raw/243072/c2e862bec37bde76f904cbed53b4e95f6ddd6c52/update.sh It now bombs with:

Re: Duby dynamic dispatch has landed!

2010-03-25 Thread Attila Szegedi
On 2010.03.25., at 3:17, Charles Oliver Nutter wrote: For Attila: I had to remove a spreadArguments handle you used for re-binding the method...not sure why. Here's the diff: Index: src/org/dynalang/dynalink/support/DynamicLinkerImpl.java

Re: Duby dynamic dispatch has landed!

2010-03-25 Thread Rémi Forax
Le 25/03/2010 03:17, Charles Oliver Nutter a écrit : I love Duby sometimes, I really do. I've just landed full dynamic dispatch support. Here's an example script and session: ~/projects/duby ➔ cat examples/dynamic.duby # Example of using a dynamic type in a method definition def

Re: Duby dynamic dispatch has landed!

2010-03-25 Thread Charles Oliver Nutter
On Thu, Mar 25, 2010 at 10:12 AM, Rémi Forax fo...@univ-mlv.fr wrote: I've also found useful to propagate expected type back to the calling method. Example: if (foo()) { ... } should be translated to indy foo ()Z instead of ()Object because if () wait for a boolean. Yeah, I suppose this is

Re: Duby dynamic dispatch has landed!

2010-03-25 Thread Attila Szegedi
Also worth noting is that if you specify a specific return type (i.e. boolean) at the call site, MOP will ensure that whatever method ends up invoked, the return value is converted (either using built-in JVM conversions, or even your own language-specific ones if you provide a

Re: Duby dynamic dispatch has landed!

2010-03-25 Thread Charles Oliver Nutter
On Thu, Mar 25, 2010 at 3:16 AM, Attila Szegedi szege...@gmail.com wrote: That's odd. arguments is Object[]; spreadArguments is required to unpack these arguments and pass them on to the invoked method. The dynalang-invoke's own test suites fail quite massively when I make the change, and

Re: Duby dynamic dispatch has landed!

2010-03-25 Thread John Rose
On Mar 25, 2010, at 8:12 AM, Rémi Forax wrote: I've also found useful to propagate expected type back to the calling method. Example: if (foo()) { ... } should be translated to indy foo ()Z instead of ()Object because if () wait for a boolean. Besides booleans, this is probably most

Re: Duby dynamic dispatch has landed!

2010-03-25 Thread Attila Szegedi
On 2010.03.25., at 18:33, Charles Oliver Nutter wrote: Speaking of that...I was surprised there's no baseline bootstrap method built into dynalang/invoke. It was a trivial amount of code to write, but I can imagine a lot of simple uses of dynalang/invoke will just want to use the standard

Re: Duby dynamic dispatch has landed!

2010-03-25 Thread John Rose
On Mar 25, 2010, at 10:33 AM, Charles Oliver Nutter wrote: On Thu, Mar 25, 2010 at 3:16 AM, Attila Szegedi szege...@gmail.com wrote: That's odd. arguments is Object[]; spreadArguments is required to unpack these arguments and pass them on to the invoked method. The dynalang-invoke's own

Re: Duby dynamic dispatch has landed!

2010-03-25 Thread Charles Oliver Nutter
On Thu, Mar 25, 2010 at 12:56 PM, Attila Szegedi szege...@gmail.com wrote: I did give tips for usage in DynamicLinker javadoc; the simplest you can get is: public class MyLanguageRuntime {    private static final DynamicLinker dynamicLinker = new DynamicLinkerFactory().createLinker();    

Re: Duby dynamic dispatch has landed!

2010-03-25 Thread Charles Oliver Nutter
On Thu, Mar 25, 2010 at 1:14 PM, John Rose john.r...@sun.com wrote: MethodHandleImpl.java:1104:in `raiseException': java.lang.ClassCastException: required class [Ljava.lang.Object; but encountered class java.util.Collections$UnmodifiableRandomAccessList       from MethodHandle.java:357:in

Duby dynamic dispatch has landed!

2010-03-24 Thread Charles Oliver Nutter
I love Duby sometimes, I really do. I've just landed full dynamic dispatch support. Here's an example script and session: ~/projects/duby ➔ cat examples/dynamic.duby # Example of using a dynamic type in a method definition def foo(a:dynamic) puts I got a #{a.getClass.getName} of size #{a.size}

Re: Duby dynamic dispatch has landed!

2010-03-24 Thread John Rose
Very nice stuff. Congratulations! On Mar 24, 2010, at 7:17 PM, Charles Oliver Nutter wrote: BTW, what's the current state of the art for emitting .java with an invokedynamic in it? Duby also has a .java backend, so I'll need to add indy support there as well (somehow). This statement: