[squeak-dev] The Trunk: Morphic-mt.1577.mcz

Marcel Taeumel marcel.taeumel at hpi.de
Tue Oct 15 12:48:52 UTC 2019


Well ... I think "self error: ..." would be better here. #error: is a message that can be specified by the receiver. "Error" is a global class reference. Like a hard-coded value. "Magic number"

Best,
Marcel
Am 15.10.2019 14:44:54 schrieb Thiede, Christoph <christoph.thiede at student.hpi.uni-potsdam.de>:
Just interested, what is the benefit of [Error signal: 'foo'] against [self error: 'foo']? :)

Christoph
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Dienstag, 15. Oktober 2019 13:58:28
An: squeak-dev at lists.squeakfoundation.org; packages at lists.squeakfoundation.org
Betreff: [squeak-dev] The Trunk: Morphic-mt.1577.mcz
 
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1577.mcz [http://source.squeak.org/trunk/Morphic-mt.1577.mcz]

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

Name: Morphic-mt.1577
Author: mt
Time: 15 October 2019, 1:58:16.523992 pm
UUID: 1d4a5d6b-aeee-5242-b9ef-d2c81fedd846
Ancestors: Morphic-mt.1576

Better error message in pluggable lists for misbehaving models. :-)

=============== Diff against Morphic-mt.1576 ===============

Item was changed:
  ----- Method: PluggableListMorph>>getFullList (in category 'model access - cached') -----
  getFullList
         "The full, unfiltered list. Cached result, see #updateList. Prefer getListSelector over getListElementSelector if both a set."
        
         ^ fullList ifNil: [
                 fullList := getListSelector
                         ifNotNil: [:sel | model perform: sel]
                         ifNil: [(getListSizeSelector notNil and: [getListElementSelector notNil])
                                 ifTrue: [       (1 to: self getListSize) collect: [:index | self getListItem: index]]
+                                ifFalse: [#() "We cannot get the full list."]].
+                fullList ifNil: [Error signal: 'The model must never provide ''nil'' as a list but only a collection.'].
+                fullList]!
-                                ifFalse: [#() "We cannot get the full list."]]]!

Item was changed:
  ----- Method: PluggableListMorph>>updateListFilter (in category 'updating') -----
  updateListFilter
 
         | selection |
+        selection := self selectionIndex = 0 "Avoid fetching #getList here."
+                ifTrue: [nil]
+                ifFalse: [self selection].
-        selection := self selection.
 
         list := nil.
         modelToView := nil.
         viewToModel := nil.
 
         self getList.
        
         "Try to restore the last selection."
         selection ifNotNil: [self selection: selection].!


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


More information about the Squeak-dev mailing list