[squeak-dev] The Trunk: Environments-dtl.72.mcz

Jakob Reschke forums.jakob at resfarm.de
Sun Mar 18 10:40:14 UTC 2018


Hi Eliot,

Note that self bindings select: is not the same as self select: for an
Environment, as the latter only enumerates the declarations (its "own"
bindings).

Seems like the only sender is Class rootsOfTheWorld, which itself is
unsent. In that case, the Smalltalk "root" environment is hard-coded
and the specifics of bindings vs. declarations do not really matter.
But what should #rootClasses answer for other, possibly isolated
environments? What does the sender want to know?
- For an empty environment (no classes contained), should it answer an
empty collection?
- Should the answer change if the "root" environment is imported?
- For an environment that a) does not contain ProtoObject or Object,
but other classes deriving from them, and b) does not import the
"root" environment, should it answer an empty collection,
{ProtoObject} (although it is not imported) via superclass relations,
or something else?
- Should the answer change if the "root" environment is imported?

By the way, would it work to have a second (different) ProtoObject
class in the image (in a different environment or under a different
name)?

Best regards,
Jakob

2018-03-18 9:18 GMT+01:00 Eliot Miranda <eliot.miranda at gmail.com>:
> 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