The Trunk: Morphic-mt.1577.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-mt.1577.mcz

commits-2
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
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].!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.1577.mcz

Christoph Thiede

Just interested, what is the benefit of [Error signal: 'foo'] against [self error: 'foo']? :)


Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]>
Gesendet: Dienstag, 15. Oktober 2019 13:58:28
An: [hidden email]; [hidden email]
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

==================== 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].!




Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-mt.1577.mcz

marcel.taeumel
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 <[hidden email]>:

Just interested, what is the benefit of [Error signal: 'foo'] against [self error: 'foo']? :)


Christoph


Von: Squeak-dev <[hidden email]> im Auftrag von [hidden email] <[hidden email]>
Gesendet: Dienstag, 15. Oktober 2019 13:58:28
An: [hidden email]; [hidden email]
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

==================== 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].!