[Moose-dev] Re: Issue with RuntimeStorage

Alexandre Bergel alexandre at bergel.eu
Mon Nov 30 14:47:28 MET 2009


Thanks Doru,

Alexandre


On 28 Nov 2009, at 13:55, Tudor Girba wrote:

> Hi,
>
> I fixed the issue and added two tests for it. All the other tests  
> seem to be fine.
>
> Cheers,
> Doru
>
>
> On 27 Nov 2009, at 23:57, Simon Denier wrote:
>
>>
>> On 27 nov. 2009, at 17:34, Tudor Girba wrote:
>>
>>> Hi Simon,
>>>
>>> Thanks for the explanations. Indeed, from this perspective it is  
>>> not correct, but in this case, I will replace "each isKindOf:"  
>>> with "each class =" because this is the intention.
>>
>> ok but no so ok. Be sure to run the tests because it may break a  
>> few things.
>>
>>>
>>> We can add another method with allWithKind: that looks for the  
>>> superclasses as well.
>>>
>>> Cheers,
>>> Doru
>>>
>>>
>>> On 27 Nov 2009, at 21:27, Simon Denier wrote:
>>>
>>>>
>>>> On 27 nov. 2009, at 17:06, Tudor Girba wrote:
>>>>
>>>>> Hi Alex,
>>>>>
>>>>> Why do you say that they do not have the same behavior? They  
>>>>> both return a collection with all the instances of the given  
>>>>> Class from the group.
>>>>
>>>> Alex forgot to explain the use case.
>>>>
>>>> Take some elements of ClassA, some elements of ClassB, and both  
>>>> ClassA and ClassB are subclasses of ClassC.
>>>>
>>>> Now ask aMooseModel allWithType: ClassC
>>>>
>>>> It works with a SetupStorage which performs a #isKindOf: test
>>>>
>>>> but does not work with a RuntimeStorage for which there is no  
>>>> byGroup at: ClassC
>>>> Instead, you have one group ClassA -> {a1, a2} and one group  
>>>> ClassB -> {b1, b2}, which are initialized when filling up the  
>>>> model.
>>>>
>>>> Now I havent really thought through this, but I guess it will be  
>>>> ok to do some lazy computation for such a case.
>>>>
>>>>
>>>>>
>>>>> Is just that the SetupStorage stores elements in an ArrayList,  
>>>>> which makes it faster to add elements, while the RuntimeStorage  
>>>>> has a more elaborate caching mechanism (for example byGroup) for  
>>>>> retrieving elements faster.
>>>>>
>>>>> Cheers,
>>>>> Doru
>>>>>
>>>>>
>>>>> On 27 Nov 2009, at 18:39, Alexandre Bergel wrote:
>>>>>
>>>>>> Dear List,
>>>>>>
>>>>>> While programming with Simon, we bumped into a sensible issue.  
>>>>>> Consider the two following methods:
>>>>>>
>>>>>> SetupStorage>>selectAllWithType: aSmalltalkClass
>>>>>> 	^ self select:
>>>>>> 		[ :each |
>>>>>> 		"-- select returns an ArrayList"
>>>>>> 		each isKindOf: aSmalltalkClass ]
>>>>>>
>>>>>> RuntimeStorage>>selectAllWithType: aSmalltalkClass
>>>>>> 	^ byGroup
>>>>>> 		at: aSmalltalkClass
>>>>>> 		ifAbsent: [ OrderedCollection new ]
>>>>>>
>>>>>> These two methods do not have the same behavior.
>>>>>> We could have something starting with "(byGroup keys select:  
>>>>>> [:cls | cls isKindOf: aSmalltalkClass]) ..."
>>>>>> But that would defeat the whole idea of having different  
>>>>>> storages...
>>>>>>
>>>>>> Cheers,
>>>>>> Alexandre
>>>>>> -- 
>>>>>> _,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
>>>>>> Alexandre Bergel  http://www.bergel.eu
>>>>>> ^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> _______________________________________________
>>>>>> Moose-dev mailing list
>>>>>> Moose-dev at iam.unibe.ch
>>>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>>
>>>>> --
>>>>> www.tudorgirba.com
>>>>>
>>>>> "Be rather willing to give than demanding to get."
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Moose-dev mailing list
>>>>> Moose-dev at iam.unibe.ch
>>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>>
>>>> --
>>>> Simon
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> Moose-dev mailing list
>>>> Moose-dev at iam.unibe.ch
>>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>>
>>> --
>>> www.tudorgirba.com
>>>
>>> "Problem solving should be concentrated on describing
>>> the problem in a way that is relevant for the solution."
>>>
>>>
>>>
>>> _______________________________________________
>>> Moose-dev mailing list
>>> Moose-dev at iam.unibe.ch
>>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>>
>> --
>> Simon
>>
>>
>>
>> _______________________________________________
>> Moose-dev mailing list
>> Moose-dev at iam.unibe.ch
>> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>
> --
> www.tudorgirba.com
>
> "Every now and then stop and ask yourself if the war you're fighting  
> is the right one."
>
>
>
> _______________________________________________
> Moose-dev mailing list
> Moose-dev at iam.unibe.ch
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

-- 
_,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:
Alexandre Bergel  http://www.bergel.eu
^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;._,.;:~^~:;.







More information about the Moose-dev mailing list