Ok then, here the bug entry https://pharo.fogbugz.com/f/cases/13938/Opal-custom-compilers-and-class-side-methods Slice in inbox
On 28 août 2014, at 10:24, Marcus Denker <[email protected]> wrote: > > On 27 Aug 2014, at 17:53, Camille Teruel <[email protected]> wrote: > >> 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? >> > This is a bug, clearly. > >> Also is there cases where one wants instance-side methods and class-side >> methods to be compiled with different compiler classes? > I hope not… but the, could be interesting (e.g. when experimenting). > If the overhead is not large, this would be nice. > >> 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. > > Yes, this looks good! > > Marcus
