If you treat the problem as a multiple-dispatch problem, can't you?

1. Issue all code without using the type information, as though
everything was Object in Java lingo. Doesn't stop the compiler from
issuing type errors, but not worth optimizing compiler output.

2. Use whatever method resolution algorithm you need to find the
desired method and put the found method in a method handle.

3. If a new method is loaded, invalidate all the handles. The new
methods are loaded by the class loader and therefore this is a thread-
safe operation and you don't need any additional locking.

4. Surround the call to the method with a try catch block that looks
for a class cast exception; if the exception occurs, then under a lock
invalidate the method handles and retry. To reduce code bloat, isolate
pure code and group this into one try block. EG if p1 and p2 are pure
functions then:

try { p1( ... ); p2( ... ); }
catch (ClassCatchException notUsed) { lock(); invalidateMethodHandles
(); p1( ... ); p2( ... ); release(); }

(Better still, the sequences p1( ... ); p2( ... ); could be replaced
by a function call.)

I am writing this post as a question because it is what I am thinking
about doing, so I am interested if anyone shoots the idea down.

 -- Howard.

On Nov 1, 3:04 pm, Rémi Forax <[email protected]> wrote:
> It can interest some of you,
> I've written a blog entry on a newly language which allow gradual 
> typing:http://weblogs.java.net/blog/forax/archive/2009/11/01/tales-four-fibo...
>
> Rémi
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "JVM 
Languages" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jvm-languages?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to