There is very little meaning behind the number.

The previous inspector showed the first 100 and the last 10 elements. 100 is 
anyway too large for a quick inspection, so we picked another number. I wanted 
42 but that was still large, so we are now at 21.

Doru


> On Feb 3, 2017, at 4:20 PM, Andrei Chis <chisvasileand...@gmail.com> wrote:
> 
> Yes these numbers should be refactored
> For collections only the first and the last 21 elements are displayed in the 
> Raw view. Don't remember why 21.
> 
> Cheers,
> Andrei
> 
> On Fri, Feb 3, 2017 at 3:13 AM, Ben Coman <b...@openinworld.com> wrote:
> Just curious what the magic numbers here relate to...
> and can they be factored out to a meaningful method name?
> 
> Context>>gtInspectorVariableValuePairs
>       "This is a helper method that returns a collection of 
>               variable_name -> value
>       for the current object.
>       Subclasses can override it to specialize what appears in the variables 
> presentation"
>       | bindings |
>       bindings := OrderedCollection new.
>                                       
>       1 to: (self basicSize min: 21) do: [ :index | 
>               bindings add: (index "asString""asTwoCharacterString" -> (self 
> basicAt: index)) ].
>       
>       ((self basicSize - 20) max: 22) to: (self basicSize) do: [ :index | 
> "self haltIf: [ index = 99 ]."
>               bindings add: (index "asString" -> (self basicAt: index)) ].
>       
>       bindings
>               addAll: ((self class allSlots 
>                                       collect: [ :slot | slot name -> (slot 
> read: self) ]) sort asOrderedCollection).
>       ^ bindings
> 
> 
> cheers -ben
> 

--
www.tudorgirba.com
www.feenk.com

"Beauty is where we see it."





Reply via email to