[Pharo-project] In Latest OB I cannot add a class variable

Mariano Martinez Peck marianopeck at gmail.com
Sun Oct 3 05:05:55 EDT 2010


On Sun, Oct 3, 2010 at 9:31 AM, Lukas Renggli <renggli at gmail.com> wrote:

> This works for me.
>
> 'superclassName' is the superclass name, but contains the definition
> which should be in the variable 'definition'.
>
> Looks like you need to recompile your image, the instance variable
> indexes seem to be messed up.
>

Thanks Lukas, indeed, evaluating a Compiler recompileAll was the trick to
make it work.


>
> Another bug I noticed in the ClassBuilder is that existing instances
> cannot be migrated if the old or the new class are subclasses of nil
> or ProtoObject, because #instVarAt: is then missing.
>

Yes, I saw this also. I had some proxies that extended from ProtoObject,
then I wanted them to extend from Object...

thanks!

mariano


>
> Lukas
>
> 2010/10/2 Mariano Martinez Peck <marianopeck at gmail.com>:
> >
> >
> > On Sat, Oct 2, 2010 at 8:02 PM, Lukas Renggli <renggli at gmail.com> wrote:
> >>
> >> It works for me, are you sure to use the latest code?
> >
> > yep.
> >
> > I tried to evaluate:
> >
> > ProtoObject subclass: #RBSemanticTest
> >     instanceVariableNames: 'instVar'
> >     classVariableNames: 'ClassVar'
> >     poolDictionaries: ''
> >     category: 'AST-Tests-Semantic'
> >
> >
> > and got an error in
> >
> >  AddClassChange >> definitionClass
> >     ^ Smalltalk globals at: (self superclassName ifNil: [ ^ ProtoObject
> ])
> >
> > since self superclassName answers:
> >
> >  a Text for 'ProtoObject subclass: #RBSemanticTest
> >     instanceVariableNames: ''instVar''
> >     classVariableNames: ''ClassVar''
> >     poolDictionaries: ''''
> >     category: ''AST-Tests-Semantic'''
> >
> >
> > weird....
> >
> > thanks
> >
> > mariano
> >
> >>
> >> 2010/10/2 Mariano Martinez Peck <marianopeck at gmail.com>:
> >> >
> >> >
> >> > On Sat, Oct 2, 2010 at 1:54 PM, Lukas Renggli <renggli at gmail.com>
> wrote:
> >> >>
> >> >> Ok, I fixed that. The refactoring engine now supports all the 24
> (!!!)
> >> >> distinct patterns of defining a subclass/trait in Pharo (see below).
> >> >>
> >> >>  Name: Refactoring-Changes-lr.15
> >> >>  Author: lr
> >> >>  Time: 2 October 2010, 1:50:13 pm
> >> >>  UUID: 82093dfb-e7f2-4ff7-afe7-ac7196632196
> >> >>  Ancestors: Refactoring-Changes-lr.14
> >> >>
> >> >>  - also support subclasses of nil
> >> >>
> >> >
> >> > Hi Lukas. I tried with nil and it works. However, putting ProtoObject,
> >> > it
> >> > didn't, since
> >> >
> >> > definitionClass
> >> >     ^ Smalltalk globals at: (self superclassName ifNil: [ ^
> ProtoObject
> >> > ])
> >> >
> >> > self superclassName   answers
> >> >
> >> >  a Text for 'ProtoObject variableSubclass: #MessageCatchingProxy
> >> >     instanceVariableNames: ''''
> >> >     classVariableNames: ''''
> >> >     poolDictionaries: ''''
> >> >     category: ''Proxies'''
> >> >
> >> > Cheers
> >> >
> >> > Mariano
> >> >
> >> >
> >> >>
> >> >> The undo operation of the respective actions should work as well. The
> >> >> exception here is an asymmetry (bug?) in the Pharo class definition
> >> >> strings that causes classes without traits to be printed without the
> >> >> #uses: claus. Evaluating this definition string does not remove the
> >> >> trait composition if the class happens to have one though.
> >> >>
> >> >> Lukas
> >> >>
> >> >> #('`className class instanceVariableNames: `#instanceVariableNames'
> >> >> '`className class uses: `@traitComposition instanceVariableNames:
> >> >> `#instanceVariableNames' '`@superclass subclass: `#className
> >> >> instanceVariableNames: `#instanceVariableNames classVariableNames:
> >> >> `#classVariableNames poolDictionaries: `#poolDictionaries category:
> >> >> `#category' 'ProtoObject subclass: `#className instanceVariableNames:
> >> >> `#instanceVariableNames classVariableNames: `#classVariableNames
> >> >> poolDictionaries: `#poolDictionaries category: `#category. `className
> >> >> superclass: `@superclass' '`@superclass subclass: `#className uses:
> >> >> `@traitComposition instanceVariableNames: `#instanceVariableNames
> >> >> classVariableNames: `#classVariableNames poolDictionaries:
> >> >> `#poolDictionaries category: `#category' 'ProtoObject subclass:
> >> >> `#className uses: `@traitComposition instanceVariableNames:
> >> >> `#instanceVariableNames classVariableNames: `#classVariableNames
> >> >> poolDictionaries: `#poolDictionaries category: `#category. `className
> >> >> superclass: `@superclass' '`@superclass variableByteSubclass:
> >> >> `#className instanceVariableNames: `#instanceVariableNames
> >> >> classVariableNames: `#classVariableNames poolDictionaries:
> >> >> `#poolDictionaries category: `#category' 'ProtoObject
> >> >> variableByteSubclass: `#className instanceVariableNames:
> >> >> `#instanceVariableNames classVariableNames: `#classVariableNames
> >> >> poolDictionaries: `#poolDictionaries category: `#category. `className
> >> >> superclass: `@superclass' '`@superclass variableByteSubclass:
> >> >> `#className uses: `@traitComposition instanceVariableNames:
> >> >> `#instanceVariableNames classVariableNames: `#classVariableNames
> >> >> poolDictionaries: `#poolDictionaries category: `#category'
> >> >> 'ProtoObject variableByteSubclass: `#className uses:
> >> >> `@traitComposition instanceVariableNames: `#instanceVariableNames
> >> >> classVariableNames: `#classVariableNames poolDictionaries:
> >> >> `#poolDictionaries category: `#category. `className superclass:
> >> >> `@superclass' '`@superclass variableSubclass: `#className
> >> >> instanceVariableNames: `#instanceVariableNames classVariableNames:
> >> >> `#classVariableNames poolDictionaries: `#poolDictionaries category:
> >> >> `#category' 'ProtoObject variableSubclass: `#className
> >> >> instanceVariableNames: `#instanceVariableNames classVariableNames:
> >> >> `#classVariableNames poolDictionaries: `#poolDictionaries category:
> >> >> `#category. `className superclass: `@superclass' '`@superclass
> >> >> variableSubclass: `#className uses: `@traitComposition
> >> >> instanceVariableNames: `#instanceVariableNames classVariableNames:
> >> >> `#classVariableNames poolDictionaries: `#poolDictionaries category:
> >> >> `#category' 'ProtoObject variableSubclass: `#className uses:
> >> >> `@traitComposition instanceVariableNames: `#instanceVariableNames
> >> >> classVariableNames: `#classVariableNames poolDictionaries:
> >> >> `#poolDictionaries category: `#category. `className superclass:
> >> >> `@superclass' '`@superclass variableWordSubclass: `#className
> >> >> instanceVariableNames: `#instanceVariableNames classVariableNames:
> >> >> `#classVariableNames poolDictionaries: `#poolDictionaries category:
> >> >> `#category' 'ProtoObject variableWordSubclass: `#className
> >> >> instanceVariableNames: `#instanceVariableNames classVariableNames:
> >> >> `#classVariableNames poolDictionaries: `#poolDictionaries category:
> >> >> `#category. `className superclass: `@superclass' '`@superclass
> >> >> variableWordSubclass: `#className uses: `@traitComposition
> >> >> instanceVariableNames: `#instanceVariableNames classVariableNames:
> >> >> `#classVariableNames poolDictionaries: `#poolDictionaries category:
> >> >> `#category' 'ProtoObject variableWordSubclass: `#className uses:
> >> >> `@traitComposition instanceVariableNames: `#instanceVariableNames
> >> >> classVariableNames: `#classVariableNames poolDictionaries:
> >> >> `#poolDictionaries category: `#category. `className superclass:
> >> >> `@superclass' '`@superclass weakSubclass: `#className
> >> >> instanceVariableNames: `#instanceVariableNames classVariableNames:
> >> >> `#classVariableNames poolDictionaries: `#poolDictionaries category:
> >> >> `#category' 'ProtoObject weakSubclass: `#className
> >> >> instanceVariableNames: `#instanceVariableNames classVariableNames:
> >> >> `#classVariableNames poolDictionaries: `#poolDictionaries category:
> >> >> `#category. `className superclass: `@superclass' '`@superclass
> >> >> weakSubclass: `#className uses: `@traitComposition
> >> >> instanceVariableNames: `#instanceVariableNames classVariableNames:
> >> >> `#classVariableNames poolDictionaries: `#poolDictionaries category:
> >> >> `#category' 'ProtoObject weakSubclass: `#className uses:
> >> >> `@traitComposition instanceVariableNames: `#instanceVariableNames
> >> >> classVariableNames: `#classVariableNames poolDictionaries:
> >> >> `#poolDictionaries category: `#category. `className superclass:
> >> >> `@superclass' '`traitName classTrait uses: `@traitComposition' 'Trait
> >> >> named: `#traitName uses: `@traitComposition category: `#category')
> >> >>
> >> >> On 2 October 2010 13:01, Lukas Renggli <renggli at gmail.com> wrote:
> >> >> >> Lukas, now I have another problem. I am not sure if it is OB
> latest
> >> >> >> code
> >> >> >> related, but I think so.
> >> >> >
> >> >> > No, that was always the case.
> >> >> >
> >> >> >> If you take any class, suppose RBSemanticTest and go to its
> >> >> >> definition.
> >> >> >> Change it so that it extends from ProtoObject instead of TestCase.
> >> >> >> When
> >> >> >> you
> >> >> >> accept the code (save it), the browser goes directly to Browse
> >> >> >> ProtoObject,
> >> >> >> actually to :
> >> >> >>
> >> >> >> ProtoObject subclass: #ProtoObject
> >> >> >>     instanceVariableNames: ''
> >> >> >>     classVariableNames: ''
> >> >> >>     poolDictionaries: ''
> >> >> >>     category: 'Kernel-Objects'.
> >> >> >> ProtoObject superclass: nil
> >> >> >
> >> >> > Creating a subclass like this was never supported by the
> refactoring
> >> >> > engine.
> >> >> >
> >> >> > You have to write it like:
> >> >> >
> >> >> > nil subclass: #ProtoObject
> >> >> >      instanceVariableNames: ''
> >> >> >      classVariableNames: ''
> >> >> >      poolDictionaries: ''
> >> >> >      category: 'Kernel-Objects'
> >> >> >
> >> >> > Lukas
> >> >> >
> >> >> > --
> >> >> > Lukas Renggli
> >> >> > www.lukas-renggli.ch
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Lukas Renggli
> >> >> www.lukas-renggli.ch
> >> >>
> >> >> _______________________________________________
> >> >> Pharo-project mailing list
> >> >> Pharo-project at lists.gforge.inria.fr
> >> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >> >
> >> >
> >> > _______________________________________________
> >> > Pharo-project mailing list
> >> > Pharo-project at lists.gforge.inria.fr
> >> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >> >
> >>
> >>
> >>
> >> --
> >> Lukas Renggli
> >> www.lukas-renggli.ch
> >>
> >> _______________________________________________
> >> Pharo-project mailing list
> >> Pharo-project at lists.gforge.inria.fr
> >> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
> >
> > _______________________________________________
> > Pharo-project mailing list
> > Pharo-project at lists.gforge.inria.fr
> > http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
> >
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.pharo.org/pipermail/pharo-dev_lists.pharo.org/attachments/20101003/32019b55/attachment-0001.html>


More information about the Pharo-dev mailing list