The Inbox: Tools-laza.218.mcz

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

The Inbox: Tools-laza.218.mcz

commits-2
Alexander Lazarević uploaded a new version of Tools to project The Inbox:
http://source.squeak.org/inbox/Tools-laza.218.mcz

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

Name: Tools-laza.218
Author: laza
Time: 22 March 2010, 5:16:02.016 pm
UUID: aa54427c-5fc5-4f5c-b283-deb2a7c85d5d
Ancestors: Tools-laza.217

Even if this does not find a majority and so is doomed for the dumpster:
List instance vars alphabetically in an inspector.

=============== Diff against Tools-laza.216 ===============

Item was added:
+ ----- Method: Inspector>>instVarValueAt: (in category 'accessing') -----
+ instVarValueAt: anIndex
+ ^ object instVarAt: (self instVarMap at: anIndex) value!

Item was changed:
+ ----- Method: BasicInspector>>inspect: (in category 'initialize-release') -----
- ----- Method: BasicInspector>>inspect: (in category 'as yet unclassified') -----
  inspect: anObject
  "Initialize the receiver so that it is inspecting anObject. There is no
  current selection."
 
- self initialize.
  object := anObject.
+ self initialize.
  selectionIndex := 0.
  contents := ''!

Item was changed:
  ----- Method: Inspector>>selection (in category 'selecting') -----
  selection
  "The receiver has a list of variables of its inspected object.
  One of these is selected. Answer the value of the selected variable."
  | basicIndex |
  selectionIndex = 0 ifTrue: [^ ''].
  selectionIndex = 1 ifTrue: [^ object].
  selectionIndex = 2 ifTrue: [^ object longPrintStringLimitedTo: 20000].
  (selectionIndex - 2) <= object class instSize
+ ifTrue: [^ self instVarValueAt: selectionIndex - 2].
- ifTrue: [^ object instVarAt: selectionIndex - 2].
  basicIndex := selectionIndex - 2 - object class instSize.
  (object basicSize <= (self i1 + self i2)  or: [basicIndex <= self i1])
  ifTrue: [^ object basicAt: basicIndex]
  ifFalse: [^ object basicAt: object basicSize - (self i1 + self i2) + basicIndex]!

Item was added:
+ ----- Method: Inspector>>sortedInstVarMap (in category 'accessing') -----
+ sortedInstVarMap
+ ^ self originalInstVarMap asSortedCollection!

Item was added:
+ ----- Method: BasicInspector>>instVarMap (in category 'accessing') -----
+ instVarMap
+ ^ self originalInstVarMap!

Item was changed:
  ----- Method: Inspector>>baseFieldList (in category 'accessing') -----
  baseFieldList
  "Answer an Array consisting of 'self'
  and the instance variable names of the inspected object."
 
  ^ (Array with: 'self' with: 'all inst vars')
+ , self instVarNames !
- , object class allInstVarNames!

Item was added:
+ ----- Method: Inspector>>originalInstVarMap (in category 'accessing') -----
+ originalInstVarMap
+ ^ object class allInstVarNames withIndexCollect: [:each :idx | each -> idx]!

Item was added:
+ ----- Method: Inspector>>instVarNames (in category 'accessing') -----
+ instVarNames
+ ^ self instVarMap collect: [:each | each key]!

Item was added:
+ ----- Method: Inspector>>defaultInstVarMap (in category 'accessing') -----
+ defaultInstVarMap
+ ^ self sortedInstVarMap!

Item was added:
+ ----- Method: Inspector>>instVarMap (in category 'accessing') -----
+ instVarMap
+ ^ self sortedInstVarMap!


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-laza.218.mcz

Chris Muller-3
Can this be a preference please?

I prefer the instVars to be displayed in slot-order..  If we have so
many instVars in the list that alphabetization helps then I would use
the keyboard anyway; manual eye-scanning is for the birds!



On Mon, Mar 22, 2010 at 11:16 AM,  <[hidden email]> wrote:

> Alexander Lazarevi&#263; uploaded a new version of Tools to project The Inbox:
> http://source.squeak.org/inbox/Tools-laza.218.mcz
>
> ==================== Summary ====================
>
> Name: Tools-laza.218
> Author: laza
> Time: 22 March 2010, 5:16:02.016 pm
> UUID: aa54427c-5fc5-4f5c-b283-deb2a7c85d5d
> Ancestors: Tools-laza.217
>
> Even if this does not find a majority and so is doomed for the dumpster:
> List instance vars alphabetically in an inspector.
>
> =============== Diff against Tools-laza.216 ===============
>
> Item was added:
> + ----- Method: Inspector>>instVarValueAt: (in category 'accessing') -----
> + instVarValueAt: anIndex
> +       ^ object instVarAt: (self instVarMap at: anIndex) value!
>
> Item was changed:
> + ----- Method: BasicInspector>>inspect: (in category 'initialize-release') -----
> - ----- Method: BasicInspector>>inspect: (in category 'as yet unclassified') -----
>  inspect: anObject
>        "Initialize the receiver so that it is inspecting anObject. There is no
>        current selection."
>
> -       self initialize.
>        object := anObject.
> +       self initialize.
>        selectionIndex := 0.
>        contents := ''!
>
> Item was changed:
>  ----- Method: Inspector>>selection (in category 'selecting') -----
>  selection
>        "The receiver has a list of variables of its inspected object.
>        One of these is selected. Answer the value of the selected variable."
>        | basicIndex |
>        selectionIndex = 0 ifTrue: [^ ''].
>        selectionIndex = 1 ifTrue: [^ object].
>        selectionIndex = 2 ifTrue: [^ object longPrintStringLimitedTo: 20000].
>        (selectionIndex - 2) <= object class instSize
> +               ifTrue: [^ self instVarValueAt: selectionIndex - 2].
> -               ifTrue: [^ object instVarAt: selectionIndex - 2].
>        basicIndex := selectionIndex - 2 - object class instSize.
>        (object basicSize <= (self i1 + self i2)  or: [basicIndex <= self i1])
>                ifTrue: [^ object basicAt: basicIndex]
>                ifFalse: [^ object basicAt: object basicSize - (self i1 + self i2) + basicIndex]!
>
> Item was added:
> + ----- Method: Inspector>>sortedInstVarMap (in category 'accessing') -----
> + sortedInstVarMap
> +       ^ self originalInstVarMap asSortedCollection!
>
> Item was added:
> + ----- Method: BasicInspector>>instVarMap (in category 'accessing') -----
> + instVarMap
> +       ^ self originalInstVarMap!
>
> Item was changed:
>  ----- Method: Inspector>>baseFieldList (in category 'accessing') -----
>  baseFieldList
>        "Answer an Array consisting of 'self'
>        and the instance variable names of the inspected object."
>
>        ^ (Array with: 'self' with: 'all inst vars')
> +                       , self instVarNames !
> -                       , object class allInstVarNames!
>
> Item was added:
> + ----- Method: Inspector>>originalInstVarMap (in category 'accessing') -----
> + originalInstVarMap
> +       ^ object class allInstVarNames withIndexCollect: [:each :idx | each -> idx]!
>
> Item was added:
> + ----- Method: Inspector>>instVarNames (in category 'accessing') -----
> + instVarNames
> +       ^ self instVarMap collect: [:each | each key]!
>
> Item was added:
> + ----- Method: Inspector>>defaultInstVarMap (in category 'accessing') -----
> + defaultInstVarMap
> +       ^ self sortedInstVarMap!
>
> Item was added:
> + ----- Method: Inspector>>instVarMap (in category 'accessing') -----
> + instVarMap
> +       ^ self sortedInstVarMap!
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-laza.218.mcz

laza
On Mon, Mar 22, 2010 at 19:55, Chris Muller <[hidden email]> wrote:
I prefer the instVars to be displayed in slot-order..

I'm still not convinced about the benefit of the slot-order, but no need to worry. This is in the Inbox and not the trunk.

Alex


Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-laza.218.mcz

Chris Muller-3
IMO, it is useful when looking at an object to see its more general
attributes first.  For example, the "name" of the object would be near
the top, since that would be in the superclass.  Presenting the
general instVars first also suggests or implies the abstract
(superclass) behaviors that might be provided by the object, prior to
the (subclass) vars which may serve only very specific purposes..



On Mon, Mar 22, 2010 at 2:13 PM, Alexander Lazarević <[hidden email]> wrote:

> On Mon, Mar 22, 2010 at 19:55, Chris Muller <[hidden email]> wrote:
>>
>> I prefer the instVars to be displayed in slot-order..
>
> I'm still not convinced about the benefit of the slot-order, but no need to
> worry. This is in the Inbox and not the trunk.
>
> Alex
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Inbox: Tools-laza.218.mcz

laza
On Mon, Mar 22, 2010 at 23:09, Chris Muller <[hidden email]> wrote:
IMO, it is useful when looking at an object to see its more general
attributes first.  For example, the "name" of the object would be near
the top, since that would be in the superclass.  Presenting the
general instVars first also suggests or implies the abstract
(superclass) behaviors that might be provided by the object, prior to
the (subclass) vars which may serve only very specific purposes.

I agree that this might be of some value if you have a single inspector on an object, but as I tried to point out, does not help while debugging.

Alex