[squeak-dev] Re: dynamic state?
Andreas Raab
andreas.raab at gmx.de
Wed Mar 24 04:03:37 UTC 2010
On 3/23/2010 10:56 AM, Igor Stasenko wrote:
> On 23 March 2010 19:16, Andreas Raab<andreas.raab at gmx.de> wrote:
>> It's an interesting thought, but I'll make a few observations: First, the
>> usage with traits seems odd. For traits you have an explicit composition
>> step already, the step can compute required state and add that to the class
>> in question. So the original motivation is a bit off.
>>
> About traits, it was just an example, how new object format could be
> used in combination with them.
Right, except that it makes little sense since traits are static
compositions as far as the objects are concerned. Consequently anything
you could dynamically could be done statically during the composition
step. But anyways, this isn't about traits.
>> And of course, if you don't have high performance requirements, you could
>> use just a single bit to indicate that the object has additional properties
>> and use the properties dictionary to store all additional state.
>>
> if by 'properties dictionary' you mean storing it in an extra object -
> then it is different to what i proposed.
Yes, and yes. My point is that in a *lot* of situations you can achieve
the desired effect with a single extra bit in the object header if
you're willing to pay the price in performance. Given that most uses
aren't going to be performance critical, that seems like a more
reasonable step for incremental improvement than rewriting the entire
object model :-)
> This is similar to Self or JavaScript object formats, where object is
> a set of named slots.
Or to Python which has both named variables and __slots__
(http://docs.python.org/reference/datamodel.html).
Cheers,
- Andreas
More information about the Squeak-dev
mailing list
|