Initial core port of "Squeak Traits"
Brian Rice
water at tunes.org
Thu Nov 24 09:31:10 PST 2005
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Nov 24, 2005, at 6:21 AM, Márton Sasvári (IJ/ETH) wrote:
> I was reading through the new traits code the other day and got
> stuck on the following lines:
>
> ---
> ts@(TraitSum traits) services [Set new].
>
> ts@(TraitSum traits) services
> [ts bases reduce: [| :b1 :b2 | b1 services union: b2 services]].
> ---
>
> and later
>
> ---
> to@(TraitOverride traits) services
> "Act like the overlay itself."
> [to overlay services].
>
> to@(TraitOverride traits) services
> "Apply the overlay to the underlying Trait."
> [to overlay services over: to base services].
> ---
>
> isn't this a rebinding of the method loosing the first definition
> immediately ? What's going on here if not ?
Oh, that's just a mistake from my initially defining a #services vs.
#fullServices (first-level vs. recursive tallying up of services). I
changed the sense of #services to mean #fullServices, and merged the
methods; obviously I forgot to clean that one up. The second method
is the correct one.
> Actually I was looking for the #services method definitions to find
> out the purpose why they aren't defined as a slot on Trait right
> away as it is implicitly assumed that the answer to #services will
> undestand #keysDo:, #keysAndValuesDo: etc., but I gave up at this
> point.
Because TraitComponent plays that role of being a concrete holder of
services. Everything else is an operation on those (+, -, over:,
excluding:). And yes, Trait newFrom: Mapping, or Mapping as: Trait
should make a new TraitComponent; at least, I need to make sure
that's easy enough to do.
- --
- -Brian
http://tunes.org/~water/brice.vcf
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
iD8DBQFDhfjjPVkAvLW1zf4RAgwkAKCTTv5ZNpcNG7n1+qmTrgMSlZOL3ACgwRlr
Wkp6fMFM6hjfeMQnELozjzs=
=pw55
-----END PGP SIGNATURE-----
More information about the Slate
mailing list