>> Hi guys >> >> Ideally I would love to be able to use accessors as the abstraction layer >> that they can bring us: >> I mean the fact that we could avoid to have offset based bytecode means that >> we could reuse a lot more >> the methods (in special case - mixins and others). > > It's simply a bad idea.
Be scientific, bring real arguments on the table else this is not fun and I can just not reply to your email or have other preconceived statements. > If you don't want instance variables, just change the VM's object > representation, but then don't call your system Smalltalk anymore. ;) this has nothing to do with that. You can instance variable but have an execution model that use internally message sends and this way you can maximize reuse of methods for object having a different layout. This is what a good mixin implementation is doing + copy-down accessor on each mixin application. > Btw without instance variables you don't need mixins, cause you have traits. unifying behavior and state is really a way to late bound decision and increase reuse. > If you only want mixins (instead of stateful traits), then there's at least > one mixin implementation for Squeak out there. > >> >> Now I have a question does the JIT or the shortcut (not sure if this is in >> stackVM) blurry the cost of accessors >> vs. direct accesses? > > Bytecodes are still 10-12x faster with Cog than sends. You mean bytecode representing instance variable accesses are faster than sends? > P.S.: IIRC one of V8's optimizations is to use a common representation > (class) for objects that have the same slots (instance variables). And? using accessor vs direct field access has nothing to do with prototypes. So I do not understand what you are implying. Stef
