[squeak-dev] The Inbox: Morphic-ct.1639.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Mon Mar 23 09:48:57 UTC 2020


-1

LazyListMorph has only a (kind of) private communication to fulfill towards PluggableListMorph. The proper access goes through #item: or #getListItem:. See categories "list access" and "list access - cached".

If you want to make a change in this regard, you have to consider the entire protocol, which includes: #listItems, #listIcons, and #listFilterOffsets.

Best,
Marcel
Am 20.03.2020 20:50:19 schrieb commits at source.squeak.org <commits at source.squeak.org>:
Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1639.mcz

==================== Summary ====================

Name: Morphic-ct.1639
Author: ct
Time: 20 March 2020, 8:49:59.689237 pm
UUID: 068f59a1-989d-b244-ad1f-84e726dcf055
Ancestors: Morphic-eem.1638

Extracts lazy accessor in LazyListMorph

This does not only follow SRP but also makes it easier for other objects to access listItems properly. Pheno uses this, for example [1].

[1] https://github.com/tom95/Pheno/commit/ab39c5b72c1764e9d525e287f3efff99917b38e2#diff-bf98bbb5fedbbc4b66a4b825d3c8d14b

=============== Diff against Morphic-eem.1638 ===============

Item was changed:
----- Method: LazyListMorph>>item: (in category 'list access - cached') -----
item: index
"Do inst-var access on listItems here to initialize it as late as possible."

+ ^ (self listItems at: index) ifNil: [
- listItems ifNil: [listItems := Array new: self getListSize].
-
- ^ (listItems at: index) ifNil: [
| newItem itemWidth |
newItem := self getListItem: index.

"Update the width cache."
maxWidth ifNotNil: [
itemWidth := self widthToDisplayItem: newItem.
itemWidth > maxWidth ifTrue: [
maxWidth := itemWidth.
super layoutChanged]].

listItems at: index put: newItem.
newItem].!

Item was added:
+ ----- Method: LazyListMorph>>listItems (in category 'accessing') -----
+ listItems
+
+ ^ listItems ifNil: [listItems := Array new: self getListSize]!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200323/37e86985/attachment.html>


More information about the Squeak-dev mailing list