Copying/Duplicating a class also duplicates pool dictionaries

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

Copying/Duplicating a class also duplicates pool dictionaries

Ben Coman
Just bumped into a curious thing.  I went copy a class with a pool dictionary...

FFIExternalStructure subclass: #CXString
   instanceVariableNames: ''
   classVariableNames: ''
   poolDictionaries: 'CXStringFlag'
   package: 'Libclang'

and it asked me for the new name, to which I dutifully entered 'CXString2'
after which I was asked...
   "CXString2Flag does not exist. Do you want it automatically created?"

Choosing "No" fails the CXString copy since CXString2Flag does not exist.
Choosing "Yes" produces...

FFIExternalStructure subclass: #CXString2
    instanceVariableNames: ''
    classVariableNames: ''
    poolDictionaries: 'CXString2Flag'
    package: 'Libclang'

So I'm curious what the reasoning is for making a parallel copy of the
pool dictionary?

And btw, CXString2Flag gets created in the "Unclassified" package and
fails to copy the methods from the original.

cheers -ben

Reply | Threaded
Open this post in threaded view
|

Re: Copying/Duplicating a class also duplicates pool dictionaries

Nicolai Hess-3-2


2016-09-06 15:39 GMT+02:00 Ben Coman <[hidden email]>:
Just bumped into a curious thing.  I went copy a class with a pool dictionary...

FFIExternalStructure subclass: #CXString
   instanceVariableNames: ''
   classVariableNames: ''
   poolDictionaries: 'CXStringFlag'
   package: 'Libclang'

and it asked me for the new name, to which I dutifully entered 'CXString2'
after which I was asked...
   "CXString2Flag does not exist. Do you want it automatically created?"

Choosing "No" fails the CXString copy since CXString2Flag does not exist.
Choosing "Yes" produces...

FFIExternalStructure subclass: #CXString2
    instanceVariableNames: ''
    classVariableNames: ''
    poolDictionaries: 'CXString2Flag'
    package: 'Libclang'

So I'm curious what the reasoning is for making a parallel copy of the
pool dictionary?

And btw, CXString2Flag gets created in the "Unclassified" package and
fails to copy the methods from the original.

cheers -ben



What image version ?

We had an issue for a similar case (the class /instance variable names were copied *and* renamed too)

18957 Class copy should not change the name of the instance variables

This was fixed n 60189

(actually, with this change, the pool dictionary definition is just *not* copied but empty, hm, but I think this is better
than creating a new with the changed name).


Reply | Threaded
Open this post in threaded view
|

Re: Copying/Duplicating a class also duplicates pool dictionaries

Ben Coman
On Tue, Sep 6, 2016 at 9:49 PM, Nicolai Hess <[hidden email]> wrote:

>
>
> 2016-09-06 15:39 GMT+02:00 Ben Coman <[hidden email]>:
>>
>> Just bumped into a curious thing.  I went copy a class with a pool
>> dictionary...
>>
>> FFIExternalStructure subclass: #CXString
>>    instanceVariableNames: ''
>>    classVariableNames: ''
>>    poolDictionaries: 'CXStringFlag'
>>    package: 'Libclang'
>>
>> and it asked me for the new name, to which I dutifully entered 'CXString2'
>> after which I was asked...
>>    "CXString2Flag does not exist. Do you want it automatically created?"
>>
>> Choosing "No" fails the CXString copy since CXString2Flag does not exist.
>> Choosing "Yes" produces...
>>
>> FFIExternalStructure subclass: #CXString2
>>     instanceVariableNames: ''
>>     classVariableNames: ''
>>     poolDictionaries: 'CXString2Flag'
>>     package: 'Libclang'
>>
>> So I'm curious what the reasoning is for making a parallel copy of the
>> pool dictionary?
>>
>> And btw, CXString2Flag gets created in the "Unclassified" package and
>> fails to copy the methods from the original.
>>
>> cheers -ben
>
>
>
>
> What image version ?

Moose 6.0, Pharo 50761.  sorry I didn't check in latest already.  I
first wanted to understand what the expected behaviour was.


>
> We had an issue for a similar case (the class /instance variable names were
> copied *and* renamed too)
>
> 18957 Class copy should not change the name of the instance variables
>
> This was fixed n 60189
>
> (actually, with this change, the pool dictionary definition is just *not*
> copied but empty, hm, but I think this is better
> than creating a new with the changed name).

Tested in 60205, it does behave better, but I added a new issue with
this additional fix attached...
https://pharo.fogbugz.com/default.asp?19050

However are there any other class definition features (like slots)
that should be considered?  I don't know what classes use slots that
could be tested.

cheers -ben

>
>

Reply | Threaded
Open this post in threaded view
|

Re: Copying/Duplicating a class also duplicates pool dictionaries

stepharo
In reply to this post by Nicolai Hess-3-2



What image version ?

We had an issue for a similar case (the class /instance variable names were copied *and* renamed too)

yes I faced this problem it was really strange :)


18957 Class copy should not change the name of the instance variables

This was fixed n 60189

(actually, with this change, the pool dictionary definition is just *not* copied but empty, hm, but I think this is better
than creating a new with the changed name).