Pharo state corrupt, how to save my code?

144 Views Asked by At

After using DynamicComposableModel and editing my method in debugger, my Pharo 6.1 image has reached this state:

Instance of SpecLayout did not understand #visibleSlots

and

Instance of SpecLayout did not understand #instVarNames

. I cannot "File Out" my code because of these errors. I cannot even browse my class, which is actually called "UIVidya" and should be defined by

ComposableModel subclass: #UIVidya
    instanceVariableNames: 'vidya listE editE tabmgr'
    classVariableNames: ''
    poolDictionaries: ''
    category: 'vkVidya'!

. In the broken image, UIVidya classLayout returns SpecLayout. In a healthy image, UIVidya classLayout returns FixedLayout. I did not make this change on purpose and do not even know how it happened. Can I heal my broken Pharo image in-place, without abandoning the last changes?

2

There are 2 best solutions below

0
On BEST ANSWER

I was able to restore normalcy by doing this in Playground:

UIVidya layout: sdfgh

(which is the same as UIVidya layout: nil). Thanks for your attention, what really helped was aggressive use of the System Browser and Playground to compare broken and non-broken Pharo instances. Now I can "File Out" my code!

EDIT:

The problem came from outdated tutorial at https://benjamin.vanryseghem.com/projects/spec/docs/dynamic/ which includes code that sends layout:. Don't do that in modern Pharo!

2
On

It doesn't look like your image is broken. The second error message suggests that you have an instance of SpecLayout where a class (presumably SpecLayout) is expected. Try defining the methods

instVarNames
  ^self class instVarNames

visibleSlots
  ^self class visibleSlots

on the instance side of SpecLayout to see if you can keep going and find the broken object. You can always come back here with more info. Once you have repaired the problem, don't forget to remove the new spurious methods.