Recompilation (was: Re: Tips and tricks?)

Marcus Denker marcus at ira.uka.de
Thu Mar 11 11:41:18 UTC 2004


Am 11.03.2004 um 08:30 schrieb ducasse:

>
> On 10 mars 04, at 22:49, Andreas Raab wrote:
>
>>> Yes, and it's too bad that our compiler doesn't currently support
>>> this kind of easy extensibility.  I've thought in the past about
>>> having a #bindingOf: like facility but where instead of just
>>> returning an association to be put in as a literal, it returns
>>> some object that knows how to emit code (as a parse tree?
>>> bytecode?) for reads and writes.
>>
>> You could do that but it's terribly dangerous. Personally, I heavily 
>> prefer
>> a limited form of implicit self where you say "for this variable name 
>> use
>> messages". So you declare a variable "foo" and instead you get #foo 
>> and
>> #foo: when accessing it. This allows you to implement this "variable" 
>> in any
>> shape or form you want, is uniquely defined and not overly hard to
>> understand.
>
> Exactly. We were also thinking about that. Now the question is do you 
> let
> or not this accessor be public or only accessible from within the 
> class.
> The solution is... not simple. We have been discussing that with 
> nathanael and roel
> over the last year. But I think that not having iv would be a gain 
> toward simplicity.
>
What about mirror-objects? The idea behind this is that you factor out 
all the state-related
meta-methods (e.g instVarAt: ) into it's own class. Then you have an 
object of this class
as a meta-object for every object in the sytem. All access to state is 
done via this meta-object.
And this happens via message sends.

With this you have both: Access all instVars via messages without 
having to expose all
your state via accessors. For the user this would be totally 
transparent: "... a ...." is compiled
to be something like "mirror instVarNamed: 'a'", or even "mirror a".

Another thing: We should really seprate "efficiency" from all this: All 
these thing are pretty much
static at run-time (as opposed to developement). So a Jit compiler 
should be able to  optimize away
all these indirections quite nicely...

           Marcus

--
Marcus Denker marcus at ira.uka.de




More information about the Squeak-dev mailing list