<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
    <title></title>
  </head>
  <body bgcolor="#ffffff" text="#000000">
    Those safeguards are there for a reason. Just removing them without
    really understanding what's going on is asking for trouble.<br>
    <br>
    To see how to do what you want to do, but in a safe way, see (for
    instance) change set #4110. You'll need to unzip the relevant file
    in /PreviousUpdates.<br>
    <br>
    Hope this helps.<br>
    <br>
    Cheers,<br>
    <br>
    On 3/24/2023 6:30 PM, Alexandre Rousseau via Cuis-dev wrote:
    <blockquote
cite="mid:CAKmOay+JfKeF4dwwvYq_7+B7h0gJ+0ikad-6oAP0VXpiXuLUKA@mail.gmail.com"
      type="cite">
      <div dir="ltr">I just learned a new word. Thanks. :)
        <div><br>
        </div>
        <div>
          <div>I compared this behaviour to that of Squeak 6. The latter
            issues a warning but in situ recompilation succeeds without
            subsequent side effects, in and this and subsequent
            sessions.</div>
        </div>
        <div><br>
        </div>
        <div>Even replacing "Object >> become:" with the Squeak
          equivalent fails (errors). </div>
        <div><br>
        </div>
        <div>Bummer that. Will dig deeper if I can find time and shovel.</div>
        <div><br>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">On Fri, Mar 24, 2023 at
          4:55 PM Gerald Klix <<a moz-do-not-send="true"
            href="mailto:cuis.01@klix.ch" target="_blank">cuis.01@klix.ch</a>>
          wrote:<br>
        </div>
        <blockquote class="gmail_quote" style="margin: 0px 0px 0px
          0.8ex; border-left: 1px solid rgb(204, 204, 204);
          padding-left: 1ex;">
          <div bgcolor="#FFFFFF">
            <div>Oh well, this is becoming a bigger gymkhana.<br>
              <br>
              I presume you have too hack <tt>Object>>#become:</tt>;
              in essence disable all the checking code<br>
              before <tt>{ self } elementsExchangeIdentityWith: {
                otherObject }</tt>.<br>
              <br>
              NB:<br>
              The same method in Squeak just reads:<br>
              <br>
              <tt>become: otherObject </tt><tt><br>
              </tt><tt>    "Primitive. Swap the object pointers of the
                receiver and the argument.</tt><tt><br>
              </tt><tt>     All variables in the entire system that used
                to point to the receiver now</tt><tt><br>
              </tt><tt>     point to the argument, and vice-versa. Fails
                if either object is read-only</tt><tt><br>
              </tt><tt>     or is an immediate such as a SmallInteger."</tt><tt><br>
              </tt><tt><br>
              </tt><tt>    {self} elementsExchangeIdentityWith:
                {otherObject}</tt><tt><br>
              </tt><tt><br>
                <br>
              </tt>Use the browsers "versions" button to restore the old
              version.<br>
              You can do all of this while the image is running.<br>
              <br>
              Again I learned two things:<br>
              <br>
              1. Juan's precautionary code in <tt>become:</tt> checks
              all running processes.<br>
              2. Command line parsing is done after the UI's display
              process was started.<br>
              <br>
              See <tt>SystemDictionary>>#snapshot:andQuit:embedded:clearAllClassState:</tt>.<br>
              <tt>self processCommandLineArguments </tt>comes after<tt>
                <br>
                UISupervisor spawnNewMorphicProcessFor: (guiRootObject
                ifNil: [ guiRootObject := guiRootObjectClass newWorld
                ]).<br>
              </tt><br>
              <br>
              HTH,<br>
              <br>
              Gerald<br>
              <br>
              <br>
              <br>
              <br>
              On 3/24/23 8:09 PM, Alexandre Rousseau wrote:<br>
            </div>
            <blockquote type="cite">
              <div dir="ltr">
                <div>Nope. This still fails ...</div>
                <blockquote class="gmail_quote">./Squeak.app/Contents/MacOS/Squeak

                  Cuis-Smalltalk-Dev/Cuis6.0-5686.image -d "BoxedMorph
                  addInstVarName: 'someBorderStyle'"</blockquote>
                <blockquote class="gmail_quote"> ...</blockquote>
                <blockquote class="gmail_quote">Class reshaping:
                  WorldMorph has some instance running
                  #runDeferredUIMessages. This CompiledMethod would
                  become invalid. Class reshaping aborted.<br>
                  Class reshaping: WorldMorph has some instance running
                  #runDeferredUIMessages. This CompiledMethod would
                  become invalid. Class reshaping aborted.<br>
                  Class reshaping: WorldMorph has some instance running
                  #doOneCycleNow. This CompiledMethod would become
                  invalid. Class reshaping aborted.<br>
                  Class reshaping: WorldMorph has some instance running
                  #doOneCycle:. This CompiledMethod would become
                  invalid. Class reshaping aborted.<br>
                  Class reshaping: WorldMorph has some instance running
                  #mainLoop. This CompiledMethod would become invalid.
                  Class reshaping aborted.<br>
                  Class reshaping: WorldMorph has some instance running
                  #mainLoop. This CompiledMethod would become invalid.
                  Class reshaping aborted.</blockquote>
              </div>
              <br>
              <div class="gmail_quote">
                <div dir="ltr" class="gmail_attr">On Fri, Mar 24, 2023
                  at 4:23 AM Gerald Klix via Cuis-dev <<a
                    moz-do-not-send="true"
                    href="mailto:cuis-dev@lists.cuis.st" target="_blank">cuis-dev@lists.cuis.st</a>>

                  wrote:<br>
                </div>
                <blockquote class="gmail_quote">
                  <div>
                    <div>On 3/24/23 8:31 AM, Alexandre Rousseau via
                      Cuis-dev wrote:<br>
                    </div>
                    <blockquote type="cite">
                      <pre>I'm trying to modify rather than subclass BoxedMorp, adding a new instance
var to the class definition. This fails while Transcript reports what
follows.

I'm guessing that recompilation of BoxedMorph does not play well while a
WorldMorph (a subclass of BoxedMorph itself) instance is running.

What would be a way to work around this?

Class reshaping: InnerTextMorph has some instance running #acceptContents.
</pre>
                      <blockquote type="cite">
                        <pre>This CompiledMethod would become invalid. Class reshaping aborted.
Class reshaping: InnerTextMorph has some instance running
#processKeystrokeEvent:. This CompiledMethod would become invalid. Class
reshaping aborted.
Class reshaping: InnerTextMorph has some instance running
#processKeystrokeEvent:. This CompiledMethod would become invalid. Class
reshaping aborted.
Class reshaping: InnerTextMorph has some instance running #keyStroke:.
This CompiledMethod would become invalid. Class reshaping aborted.
Class reshaping: InnerTextMorph has some instance running #keyStroke:.
This CompiledMethod would become invalid. Class reshaping aborted.
Class reshaping: HandMorph has some instance running
#startKeyboardDispatch:. This CompiledMethod would become invalid. Class
reshaping aborted.
Class reshaping: HandMorph has some instance running #processEventQueue.
This CompiledMethod would become invalid. Class reshaping aborted.
Class reshaping: WorldMorph has some instance running #doOneCycleNow. This
CompiledMethod would become invalid. Class reshaping aborted.
Class reshaping: WorldMorph has some instance running #handsDo:. This
CompiledMethod would become invalid. Class reshaping aborted.
Class reshaping: WorldMorph has some instance running #doOneCycleNow. This
CompiledMethod would become invalid. Class reshaping aborted.
Class reshaping: WorldMorph has some instance running #doOneCycle:. This
CompiledMethod would become invalid. Class reshaping aborted.
Class reshaping: WorldMorph has some instance running #mainLoop. This
CompiledMethod would become invalid. Class reshaping aborted.
Class reshaping: WorldMorph has some instance running #mainLoop. This
CompiledMethod would become invalid. Class reshaping aborted.
</pre>
                      </blockquote>
                      <br>
                      <fieldset></fieldset>
                    </blockquote>
                    First, let me analyze that problem.<br>
                    Nearly every Morph you see on the screen – <tt>SystemWindow</tt>
                    and <br>
                    thus <tt>BrowserWindow</tt> – is derived from <tt>BoxedMorph</tt>.
                    Juan added save guards<br>
                    to Object>>#become:, because adding the target
                    object of <tt>#become:</tt><br>
                    might still have some active contexts on the stack
                    and these<br>
                    active contexts refer to methods that where compiled
                    for the<br>
                    source object of <tt>#bceome:</tt>. In your case
                    the source object<br>
                    is the old class and the target object is the new
                    class, with<br>
                    the added instance variable. If you will add the
                    instance variable<br>
                    add the end, it would work out. Otherwise some<br>
                    morphic code in the running system will certainly
                    crash.<br>
                    <br>
                    Now for ways around this mess:<br>
                    <br>
                    Do you really need an instance variable?<br>
                    Morphs also have properties, that should<br>
                    be used if the instance variable is <tt>nil</tt>
                    for<br>
                    most morphs. Properties come in handy here,<br>
                    because the can be added at run-time.<br>
                    <br>
                    If you insist on adding instance variables,<br>
                    you have to add your variable with<br>
                    no morphic code on the stack, meaning you have to <br>
                    do it from the command line.<br>
                    There is a method <tt>Class>>#addInstVarName:</tt>
                    that lets<br>
                    you add instance variables.<br>
                    <br>
                    You can use the <tt>-e</tt> command-line option<br>
                    to execute code from the command line.<br>
                    <br>
                    <br>
                    HTH,<br>
                    <br>
                    Gerald<br>
                  </div>
                  -- <br>
                  Cuis-dev mailing list<br>
                  <a moz-do-not-send="true"
                    href="mailto:Cuis-dev@lists.cuis.st" target="_blank">Cuis-dev@lists.cuis.st</a><br>
                  <a moz-do-not-send="true"
                    href="https://lists.cuis.st/mailman/listinfo/cuis-dev"
                    rel="noreferrer" target="_blank">https://lists.cuis.st/mailman/listinfo/cuis-dev</a><br>
                </blockquote>
              </div>
            </blockquote>
            <br>
          </div>
        </blockquote>
      </div>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich</pre>
  </body>
</html>