Instance variable pull up broken

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

Instance variable pull up broken

niko.schwarz
Here's a funny way to crash your image. Works in:

Pharo-1.1-11367-Beta
Latest update: #11367

Make a class named AbstractBla, with two subclasses: SubA, SubB. Then,
add to both SubA and SubB the identically named instance variable:
instVar. Now, use the "pull up" refactoring in OmniBrowser on SubA to
pull up instVar into the superclass. As you correctly guess, that
breaks SubB, because now both its superclass and SubB have an instance
variable named instVar. But, instead of refusing to refactor,
OmniBrowser dutifully refactors and takes the image with it.

I hope that was understandable.

Cheers,

Niko


--
http://scg.unibe.ch/staff/Schwarz
twitter.com/nes1983
Tel: +41 076 235 8683

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Instance variable pull up broken

Lukas Renggli
I cannot reproduce. If you look at the code you should see that what
you describe should not happen:

transform
        class allSubclasses do:
                        [:each |
                        (each directlyDefinesInstanceVariable: variableName)
                                ifTrue: [each removeInstanceVariable: variableName]].
        class addInstanceVariable: variableName

Maybe your class hierarchy is broken?

Lukas

On 7 August 2010 22:18, Niko Schwarz <[hidden email]> wrote:

> Here's a funny way to crash your image. Works in:
>
> Pharo-1.1-11367-Beta
> Latest update: #11367
>
> Make a class named AbstractBla, with two subclasses: SubA, SubB. Then,
> add to both SubA and SubB the identically named instance variable:
> instVar. Now, use the "pull up" refactoring in OmniBrowser on SubA to
> pull up instVar into the superclass. As you correctly guess, that
> breaks SubB, because now both its superclass and SubB have an instance
> variable named instVar. But, instead of refusing to refactor,
> OmniBrowser dutifully refactors and takes the image with it.
>
> I hope that was understandable.
>
> Cheers,
>
> Niko
>
>
> --
> http://scg.unibe.ch/staff/Schwarz
> twitter.com/nes1983
> Tel: +41 076 235 8683
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Instance variable pull up broken

niko.schwarz
Hmm, I can't reproduce it in a fresh image, either. Sorry for the noise.

Niko

On Sat, Aug 7, 2010 at 10:39 PM, Lukas Renggli <[hidden email]> wrote:

> I cannot reproduce. If you look at the code you should see that what
> you describe should not happen:
>
> transform
>        class allSubclasses do:
>                        [:each |
>                        (each directlyDefinesInstanceVariable: variableName)
>                                ifTrue: [each removeInstanceVariable: variableName]].
>        class addInstanceVariable: variableName
>
> Maybe your class hierarchy is broken?
>
> Lukas
>
> On 7 August 2010 22:18, Niko Schwarz <[hidden email]> wrote:
>> Here's a funny way to crash your image. Works in:
>>
>> Pharo-1.1-11367-Beta
>> Latest update: #11367
>>
>> Make a class named AbstractBla, with two subclasses: SubA, SubB. Then,
>> add to both SubA and SubB the identically named instance variable:
>> instVar. Now, use the "pull up" refactoring in OmniBrowser on SubA to
>> pull up instVar into the superclass. As you correctly guess, that
>> breaks SubB, because now both its superclass and SubB have an instance
>> variable named instVar. But, instead of refusing to refactor,
>> OmniBrowser dutifully refactors and takes the image with it.
>>
>> I hope that was understandable.
>>
>> Cheers,
>>
>> Niko
>>
>>
>> --
>> http://scg.unibe.ch/staff/Schwarz
>> twitter.com/nes1983
>> Tel: +41 076 235 8683
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>



--
http://scg.unibe.ch/staff/Schwarz
twitter.com/nes1983
Tel: +41 076 235 8683

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Instance variable pull up broken

Stéphane Ducasse
if you can reproduce it or understand what was your problem we are interested because we
want to make sure that the next classbuilder should be really robust.

Stef
On Aug 8, 2010, at 1:24 AM, Niko Schwarz wrote:

> Hmm, I can't reproduce it in a fresh image, either. Sorry for the noise.
>
> Niko
>
> On Sat, Aug 7, 2010 at 10:39 PM, Lukas Renggli <[hidden email]> wrote:
>> I cannot reproduce. If you look at the code you should see that what
>> you describe should not happen:
>>
>> transform
>>        class allSubclasses do:
>>                        [:each |
>>                        (each directlyDefinesInstanceVariable: variableName)
>>                                ifTrue: [each removeInstanceVariable: variableName]].
>>        class addInstanceVariable: variableName
>>
>> Maybe your class hierarchy is broken?
>>
>> Lukas
>>
>> On 7 August 2010 22:18, Niko Schwarz <[hidden email]> wrote:
>>> Here's a funny way to crash your image. Works in:
>>>
>>> Pharo-1.1-11367-Beta
>>> Latest update: #11367
>>>
>>> Make a class named AbstractBla, with two subclasses: SubA, SubB. Then,
>>> add to both SubA and SubB the identically named instance variable:
>>> instVar. Now, use the "pull up" refactoring in OmniBrowser on SubA to
>>> pull up instVar into the superclass. As you correctly guess, that
>>> breaks SubB, because now both its superclass and SubB have an instance
>>> variable named instVar. But, instead of refusing to refactor,
>>> OmniBrowser dutifully refactors and takes the image with it.
>>>
>>> I hope that was understandable.
>>>
>>> Cheers,
>>>
>>> Niko
>>>
>>>
>>> --
>>> http://scg.unibe.ch/staff/Schwarz
>>> twitter.com/nes1983
>>> Tel: +41 076 235 8683
>>>
>>> _______________________________________________
>>> Pharo-project mailing list
>>> [hidden email]
>>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>>
>>
>>
>>
>> --
>> Lukas Renggli
>> www.lukas-renggli.ch
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
> --
> http://scg.unibe.ch/staff/Schwarz
> twitter.com/nes1983
> Tel: +41 076 235 8683
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Instance variable pull up broken

Tim Mackinnon
In reply to this post by Lukas Renggli
I've been trying out the refactoring tools with a specific 2  
subclasses of a common class example - and I didn't get this problem  
either - I could push up methods and pull up instance variables of my  
two common subclasses.

The only point I would note - it seems inconsistent that you "pull up"  
instance variables but "push up" methods (I recall it was a naming act  
of history, but it would be nice to call it "push up" everywhere.)

Tim

On 7 Aug 2010, at 21:39, Lukas Renggli wrote:

> I cannot reproduce. If you look at the code you should see that what
> you describe should not happen:
>
> transform
> class allSubclasses do:
> [:each |
> (each directlyDefinesInstanceVariable: variableName)
> ifTrue: [each removeInstanceVariable: variableName]].
> class addInstanceVariable: variableName
>
> Maybe your class hierarchy is broken?
>
> Lukas
>
> On 7 August 2010 22:18, Niko Schwarz <[hidden email]>  
> wrote:
>> Here's a funny way to crash your image. Works in:
>>
>> Pharo-1.1-11367-Beta
>> Latest update: #11367
>>
>> Make a class named AbstractBla, with two subclasses: SubA, SubB.  
>> Then,
>> add to both SubA and SubB the identically named instance variable:
>> instVar. Now, use the "pull up" refactoring in OmniBrowser on SubA to
>> pull up instVar into the superclass. As you correctly guess, that
>> breaks SubB, because now both its superclass and SubB have an  
>> instance
>> variable named instVar. But, instead of refusing to refactor,
>> OmniBrowser dutifully refactors and takes the image with it.
>>
>> I hope that was understandable.
>>
>> Cheers,
>>
>> Niko
>>
>>
>> --
>> http://scg.unibe.ch/staff/Schwarz
>> twitter.com/nes1983
>> Tel: +41 076 235 8683
>>
>> _______________________________________________
>> Pharo-project mailing list
>> [hidden email]
>> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
>>
>
>
>
> --
> Lukas Renggli
> www.lukas-renggli.ch
>
> _______________________________________________
> Pharo-project mailing list
> [hidden email]
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Instance variable pull up broken

Lukas Renggli
> The only point I would note - it seems inconsistent that you "pull up"
> instance variables but "push up" methods (I recall it was a naming act of
> history, but it would be nice to call it "push up" everywhere.)

That was unified a few months ago.

Lukas

--
Lukas Renggli
www.lukas-renggli.ch

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project