On 2009.08.02., at 16:28, Rémi Forax wrote:
> I've quickly browse the source code.
>
> I've found a small error in
> CompositeTypeBasedGuardingDynamicLinker#addTypeBased,
> case 1 should be:
>
> case 1: {
> llinkers.addAll(tblinkers);
> tblinkers.clear();
> break;
> }
Thanks. How on Earth did you spot that?!
> I think you can simplify drastically the way you
> find a linker for a given object.
>
> The JSR292 already recognizes that a class is responsible
> to register itself to handle all invokedynamic
> of all methods of that class.
>
> I think you can follow exactly the same way and says
> that a class should register its own linker.
> More that one class can have the same linker and
> the way linkers are managed must be let to the dyn language
> runtime.
>
> class ADynamicClass {
> static {
> MOPLinkage.registerLinker(ADynamicClass.class,
> MyDynamicLanguageRuntime.LINKER);
> }
> }
> // with
> classMyDynamicLanguageRuntime {
> public static final LinkerLINKER = ...
> }
>
> registerLinker will do two things :
> - use Linkage.registerBootstrapMethod with the MOP bootstrap method
> - register that the linker should be used for all receivers of class
> ADynamicClass.
Arguably, this could be done. I do have several reasons for choosing
the approach I chose (JAR service mechanism), namely:
1. it's less complex for the developer of the language runtime;
instead of including code to associate a linker with a class in every
class, they just need to declare it in a file
2. not every linker needs to be class-based (although I expect the
majority will be)
3. 3rd party users of language runtimes can create implementations of
language-specific classes; i.e. you can have your own class
"implements IRubyObject" and have JRuby use it as a native. With my
approach, a theoretical RubyLinker would handle that class too, with
class-based registering you'd need to have the class register itself
explicitly.
And thanks for thinking this along with me. (I read on your blog
you're on vacation too, right? Seems like most productive periods for
working on cool stuff :-) )
Attila.
> 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
-~----------~----~----~----~------~----~------~--~---