Accessing variables through sending messages
stéphane ducasse
ducasse at iam.unibe.ch
Tue Jun 21 21:04:42 UTC 2005
On 21 juin 05, at 21:37, Andreas Raab wrote:
> Alexandre Bergel wrote:
>
>> Sorry to not have given more information about what I try to achieve.
>> I have been working on adding state to traits. The idea is that
>> the offset for a variable is not constant anymore. For instance,
>> let's assume the following:
>> T1 defines v1 "offset of v1 = 1"
>> T2 defines v2 "offset of v2 = 1"
>> T3 uses T2 + T1 "offset of v2 = 1 and v1 = 2"
>>
>
> This looks like premature static optimization for me. What's wrong
> with just using messages? E.g., if all references to v1 and v2 are
> compiled into message sends (something the compiler can do
> trivially [*]) you can define the "offset" in any way you like in
> the leaf class (T3).
I can reply (but I may be I'm wrong I did not look at the
implementation of alex).
Our idea was ok let us try to have dictionary like semantics for
state composition and how does it solve the problem to introduce
state in traits. So we took really the most dummy approach just to
get a feel
of the model. Because we wanted to understand how the model should
looks like. So our initial implementation is certainly not the best
because this is a hack. But thanks for the discussion.
Traits with state breaks the flatenning property but this is fun to
see a language with only traits :)
Stef
More information about the Squeak-dev
mailing list
|