<div dir="ltr">Hi Jacob,<div class="gmail_extra"><br><div class="gmail_quote">On Tue, Mar 20, 2018 at 9:06 AM, Jakob Reschke <span dir="ltr"><<a href="mailto:forums.jakob@resfarm.de" target="_blank">forums.jakob@resfarm.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">Hi Eliot,<br>
<br>
ok, from your answers, it should access the declarations, not the<br>
bindings of an environment.<br>
<br>
With your requirement, that could be:<br>
<span class="gmail-">   (self select: [:each | each isBehavior and: [each superclass isNil<br>
</span>and: [each environment == self "not misplaced via at:put:"]]]) asSet<br>
asArray<br></blockquote><div><br></div><div>I don't understand "each environment == self".  A comment as to how this works would be good.  Further, is it not possible to declare a variable whose value is a root class?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
I removed the #value sends because select: only iterates over the<br>
values of a dictionary(-like object). </blockquote><div><br></div><div>Good point.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">I do not like the dependency on<br>
the names of things, but that could also be an overreaction as the<br>
result of my endeavor to make the tools work across environments. ;-)<br></blockquote><div><br></div><div>However it works the issue is avoiding duplicates caused by defining variables whose values are classes.  I used #name as that's the hammer I know.  I hope there's a better way :-)  Further, I hope you'll find it :-)</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex">
<br>
Kind regards,<br>
Jakob<br>
<div class="gmail-HOEnZb"><div class="gmail-h5"><br>
<br>
2018-03-18 17:02 GMT+01:00 Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>>:<br>
> Hi Jacob,<br>
><br>
>> On Mar 18, 2018, at 3:40 AM, Jakob Reschke <<a href="mailto:forums.jakob@resfarm.de">forums.jakob@resfarm.de</a>> wrote:<br>
>><br>
>> Hi Eliot,<br>
>><br>
>> Note that self bindings select: is not the same as self select: for an<br>
>> Environment, as the latter only enumerates the declarations (its "own"<br>
>> bindings).<br>
>><br>
>> Seems like the only sender is Class rootsOfTheWorld, which itself is<br>
>> unsent. In that case, the Smalltalk "root" environment is hard-coded<br>
>> and the specifics of bindings vs. declarations do not really matter.<br>
>> But what should #rootClasses answer for other, possibly isolated<br>
>> environments? What does the sender want to know?<br>
>> - For an empty environment (no classes contained), should it answer an<br>
>> empty collection?<br>
><br>
> Yes<br>
><br>
>> - Should the answer change if the "root" environment is imported?<br>
><br>
> No<br>
><br>
>> - For an environment that a) does not contain ProtoObject or Object,<br>
>> but other classes deriving from them, and b) does not import the<br>
>> "root" environment, should it answer an empty collection,<br>
>> {ProtoObject} (although it is not imported) via superclass relations,<br>
>> or something else?<br>
><br>
> Empty<br>
><br>
>> - Should the answer change if the "root" environment is imported?<br>
>><br>
>> By the way, would it work to have a second (different) ProtoObject<br>
>> class in the image (in a different environment or under a different<br>
>> name)?<br>
><br>
> It should, right?<br>
><br>
> the rootsOfTheWorld are easy to understand and hence to extend to environments.  Pre environments theRootsOfTheWorld are the classes that have no superclass (have nil as their superclass).  theRootsOfTheWorld is a set (has no duplicates) but can be a sequence.  Hence, given that Smalltalk can contain user defined variables, and the values of these variables can be anything, including classes, the computation of theRootsOfTheWorld should filter out variables that just happen to refer to root classes to ensure that a set is answered.<br>
><br>
> Extending this to environments then is straight forward.  theRootsOfTheWorld in an environment is a set of the classes defined in that environment that have no superclass. The computation should not be confusable by variables whose values just happen to be toot classes.<br>
><br>
> Now, given that theRootsOfTheWorld are used as the roots of code search (allImplementosOf: et al) the notion of a pet-environment theRootsOfTheWorld is suspect, given that code search should be able to search all code.  But let's at least get the per-environment definition correct before we try and define a system-wide one.<br>
><br>
>><br>
>> Best regards,<br>
>> Jakob<br>
>><br>
>> 2018-03-18 9:18 GMT+01:00 Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com">eliot.miranda@gmail.com</a>>:<br>
>>> Hi David,<br>
>>><br>
>>>>> On Mar 17, 2018, at 8:19 PM, David T. Lewis <<a href="mailto:lewis@mail.msen.com">lewis@mail.msen.com</a>> wrote:<br>
>>>>><br>
>>>>> On Sat, Mar 17, 2018 at 04:54:36PM -0700, Eliot Miranda wrote:<br>
>>>>> Hi David,<br>
>>>>><br>
>>>>>> On Sat, Mar 17, 2018 at 12:10 PM, <<a href="mailto:commits@source.squeak.org">commits@source.squeak.org</a>> wrote:<br>
>>>>>><br>
>>>>>> David T. Lewis uploaded a new version of Environments to project The Trunk:<br>
>>>>>> <a href="http://source.squeak.org/trunk/Environments-dtl.72.mcz" rel="noreferrer" target="_blank">http://source.squeak.org/<wbr>trunk/Environments-dtl.72.mcz</a><br>
>>>>>><br>
>>>>>> ==================== Summary ====================<br>
>>>>>><br>
>>>>>> Name: Environments-dtl.72<br>
>>>>>> Author: dtl<br>
>>>>>> Time: 17 March 2018, 3:09:49.564301 pm<br>
>>>>>> UUID: e9aed004-8798-41c0-83f9-<wbr>a04f5963dd55<br>
>>>>>> Ancestors: Environments-jr.71, Environments-fbs.27<br>
>>>>>><br>
>>>>>> Merge Environments-fbs.27<br>
>>>>>><br>
>>>>>> =============== Diff against Environments-jr.71 ===============<br>
>>>>>><br>
>>>>>> Item was added:<br>
>>>>>> + ----- Method: Environment>>rootClasses (in category 'accessing') -----<br>
>>>>>> + rootClasses<br>
>>>>>> +       "return a collection of classes which have a nil superclass"<br>
>>>>>> +       ^ (self select: [:each | each isBehavior and: [each superclass<br>
>>>>>> isNil]]) asOrderedCollection.!<br>
>>>>>><br>
>>>>><br>
>>>>> At least for me this isn't quite good enough.  There's a possibility that<br>
>>>>> someone could establish a variable whose value is a root, e.g. by<br>
>>>>><br>
>>>>> Smalltalk at: #MyRootClass put: ProtoObject<br>
>>>>><br>
>>>>> and that would cause rootClasses to answer a duplicate.  So IMO it needs to<br>
>>>>> do one of<br>
>>>>> - convert to a set and then back to a collection<br>
>>>>> - answer a set<br>
>>>>> - enumerate over associations, selecting those classes whose key is the<br>
>>>>> same as their name<br>
>>>>><br>
>>>>> _,,,^..^,,,_<br>
>>>>> best, Eliot<br>
>>>><br>
>>>> Hi Eliot,<br>
>>>><br>
>>>> Do you mean this?<br>
>>>><br>
>>>> Environment>>rootClasses<br>
>>>>   "return a collection of classes which have a nil superclass"<br>
>>>>   ^ (self select: [:each | each isBehavior and: [each superclass isNil]]) asSet asOrderedCollection.<br>
>>><br>
>>> That'll do but perhaps better is<br>
>>><br>
>>>          self bindings select: [:each | each value isBehavior and: [each value superclass isNil and: [each value name == each key]]]) collect:  [:each | each value]<br>
>>><br>
>>>><br>
>>>><br>
>>>> Note, I am not the author here, just tending to the inbox :-)<br>
>>>><br>
>>>> Thanks,<br>
>>>> Dave<br>
>>>><br>
>>>><br>
>>><br>
>><br>
><br>
<br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><span style="font-size:small;border-collapse:separate"><div>_,,,^..^,,,_<br></div><div>best, Eliot</div></span></div></div></div>
</div></div>