[squeak-dev] Item equality in PluggableTreeMorph

Marcel Taeumel marcel.taeumel at hpi.de
Wed Oct 27 07:19:40 UTC 2021


Hi Christoph --

> Do we actually need identity (#==) instead of equality here?

The ObjectExplorer dynamically constructs associations/bindings for its contents. Equality would not work because it would mix up stuff like "#color -> Color white" etc.

In general, I think that the widget must use #== to avoid those issues.

> As opposed to this, #selectPath:in: uses #=.

Because that interface decouples state/representation from identity to be usable in clients.

> I would vote for #= in all three places

Nope. That would make it really hard for models to communicate changes and selection. Identity is key here.

Best,
Marcel
Am 26.10.2021 19:49:58 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>:
Hi all!

I am just fixing a bug in the PluggableTreeMorph and was stumbling upon the fact that in #updateFromChangedObject:, items are compared by identity, which makes it harder in the context of a DirectoryChooserDialog to indicate the relevant instance (i.e., you cannot use #containingDirectory which would create a new copy).

Do we actually need identity (#==) instead of equality here? Next to #updateFromChangedObject:, also #getCurrentSelectionItem is using #==. As opposed to this, #selectPath:in: uses #=. Unless you have any counter arguments, I would vote for #= in all three places to delegate equality control to the domain objects that are contained in the tree morph.

Best,
Christoph


---
Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20211027/cae15710/attachment.html>


More information about the Squeak-dev mailing list