[squeak-dev] The Trunk: Environments-dtl.72.mcz
Eliot Miranda
eliot.miranda at gmail.com
Sun Mar 18 08:18:11 UTC 2018
Hi David,
> On Mar 17, 2018, at 8:19 PM, David T. Lewis <lewis at mail.msen.com> wrote:
>
>> On Sat, Mar 17, 2018 at 04:54:36PM -0700, Eliot Miranda wrote:
>> Hi David,
>>
>>> On Sat, Mar 17, 2018 at 12:10 PM, <commits at source.squeak.org> wrote:
>>>
>>> David T. Lewis uploaded a new version of Environments to project The Trunk:
>>> http://source.squeak.org/trunk/Environments-dtl.72.mcz
>>>
>>> ==================== Summary ====================
>>>
>>> Name: Environments-dtl.72
>>> Author: dtl
>>> Time: 17 March 2018, 3:09:49.564301 pm
>>> UUID: e9aed004-8798-41c0-83f9-a04f5963dd55
>>> Ancestors: Environments-jr.71, Environments-fbs.27
>>>
>>> Merge Environments-fbs.27
>>>
>>> =============== Diff against Environments-jr.71 ===============
>>>
>>> Item was added:
>>> + ----- Method: Environment>>rootClasses (in category 'accessing') -----
>>> + rootClasses
>>> + "return a collection of classes which have a nil superclass"
>>> + ^ (self select: [:each | each isBehavior and: [each superclass
>>> isNil]]) asOrderedCollection.!
>>>
>>
>> At least for me this isn't quite good enough. There's a possibility that
>> someone could establish a variable whose value is a root, e.g. by
>>
>> Smalltalk at: #MyRootClass put: ProtoObject
>>
>> and that would cause rootClasses to answer a duplicate. So IMO it needs to
>> do one of
>> - convert to a set and then back to a collection
>> - answer a set
>> - enumerate over associations, selecting those classes whose key is the
>> same as their name
>>
>> _,,,^..^,,,_
>> best, Eliot
>
> Hi Eliot,
>
> Do you mean this?
>
> Environment>>rootClasses
> "return a collection of classes which have a nil superclass"
> ^ (self select: [:each | each isBehavior and: [each superclass isNil]]) asSet asOrderedCollection.
That'll do but perhaps better is
self bindings select: [:each | each value isBehavior and: [each value superclass isNil and: [each value name == each key]]]) collect: [:each | each value]
>
>
> Note, I am not the author here, just tending to the inbox :-)
>
> Thanks,
> Dave
>
>
More information about the Squeak-dev
mailing list
|