[Cuis-dev] Voiceless regarding behavior of statePointsTo:
Juan Vuletich
juan at cuis.st
Sat Jul 1 11:34:53 PDT 2023
On 7/1/2023 7:24 AM, Hilaire Fernandes via Cuis-dev wrote:
> Le 01/07/2023 à 12:15, Hilaire Fernandes a écrit :
>>
>> Is it the expected behavior?
>>
> I guess so.
>
Yep.
> I implemented my own variant to search, does not check circular
> reference though:
>
> treePointsTo: anObject
> " Are my instances and sub instances hold a reference of anObject"
> ^ (self statePointsTo: anObject)or: [|attributesToVisit |
> attributesToVisit := OrderedCollection new.
> 1 to: self class instSize do: [:i |
> (self instVarAt: i)isCollection ifTrue: [attributesToVisit addAll: (self instVarAt: i)] ].
> attributesToVisit anySatisfy: [:attribute |
> attribute == anObject or: [attribute treePointsTo: anObject] ] ]
>
> --
> GNU Dr. Geo
> http://drgeo.eu
> http://blog.drgeo.eu
That is a bit more expensive than needed, because of the creation of a
collection. Moreover, I wonder, why do you need this?
Cheers,
--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230701/0043fc8f/attachment.htm>
More information about the Cuis-dev
mailing list