Hi all,

With Opal, if you want to customize how methods are compiled into a class you 
can override #compilerClass on class-side:
MyClass class>>#compilerClass
        ^ MySpecialCompiler

However this custom compiler is not taken into account when compiling methods 
on the class-side:
MyClass class compilerClass ---> OpalCompiler
I was expecting to have the same compiler class for the metaclass. The 
consequence is that right now there is no way to specialize how methods are 
compiled in *one* metaclass.
Is it on purpose or is it a bug? 

Also is there cases where one wants instance-side methods and class-side 
methods to be compiled with different compiler classes?
My rough guess is that in most cases you want the same compiler class, but I 
don't fell confortable forcing that.
So I propose to add a method #classSideCompilerClass:
Class>>#classSideCompilerClass
        ^ self compilerClass

Then compilerClass can be implemented for metaclasses:
Metaclass>>#compilerClass
        ^ self instanceSide classSideCompilerClass

Likewise, if I override compilerClass, it is taken into account for both 
instance-side and class-side methods but I can still say that I want a 
different compiler for class-side methods by overriding classSideCompilerClass. 
Tell me what you think about it and if you're ok, I open a bug entry with the 
slice.

Cheers,
Camille
 

Reply via email to