Code porting to Pharo 6.1-64

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

Code porting to Pharo 6.1-64

dario trussardi
Ciao,

        i work to port some code from Pharo 4.0 to Pharo 6.1-64.

        My root class into Pharo 4.0 define the properties

                instance variable and some relative method:

                        a) propertyAt: aKey ifAbsent: aBlock

                                        ^ self properties at: aKey ifAbsent: aBlock

                        b) propertyAt: aKey ifAbsentPut: aBlock
       
                                        ^ self properties at: aKey ifAbsentPut: aBlock

                        c) propertyAt: aKey put: aValue
                       
                                        ^ self properties at: aKey put: aValue

                        d)......

        Now when i port this code into the Pharo 6.1-64 when compile the code

                the Behavior originalName method implement:

                        ^ (( self isObsolete and:[ self name beginsWith: 'AnObsolete ............


                where isObsolete   TClass   is:

                        self propertyAt: #obsolete ifAbsent: false


                But my class implement a specific propertyAt: ifAbsent:   method
       
                and the system generates errors and  don't compile the code.


        Thank you for every consideration.

                Dario


               

Reply | Threaded
Open this post in threaded view
|

Re: Code porting to Pharo 6.1-64

dario trussardi
I wrong.......

the error is relative to my root  class  ...

For this class i implemented the class method 

propertyAt: aKey ifAbsent: aBlock

This is in conflict with :

the Behavior  originalName  method  implement:

^ (( self isObsolete and:[ self name beginsWith: 'AnObsolete ............


where  isObsolete   TClass   is:

self propertyAt: #obsolete ifAbsent: false

Thanks for considerations,

Dario

Ciao,

i work to port some code from Pharo 4.0 to Pharo 6.1-64.

My root class into Pharo 4.0 define the properties

instance variable and some relative method:

a) propertyAt: aKey ifAbsent: aBlock

^ self properties at: aKey ifAbsent: aBlock

b) propertyAt: aKey ifAbsentPut: aBlock

^ self properties at: aKey ifAbsentPut: aBlock

c) propertyAt: aKey put: aValue

^ self properties at: aKey put: aValue

d)......

Now when i port this code into the Pharo 6.1-64 when compile the code

the Behavior originalName method implement:

^ (( self isObsolete and:[ self name beginsWith: 'AnObsolete ............


where isObsolete   TClass   is:

self propertyAt: #obsolete ifAbsent: false


But my class implement a specific propertyAt: ifAbsent:   method

and the system generates errors and  don't compile the code.


Thank you for every consideration.

Dario





Reply | Threaded
Open this post in threaded view
|

Re: Code porting to Pharo 6.1-64

Guillermo Polito
Hi Dario,

Have you defined those methods in the class side?

      a) propertyAt: aKey ifAbsent: aBlock
               ^ self properties at: aKey ifAbsent: aBlock
      b) propertyAt: aKey ifAbsentPut: aBlock
               ^ self properties at: aKey ifAbsentPut: aBlock
      c) propertyAt: aKey put: aValue
               ^ self properties at: aKey put: aValue

I will let Marcus answer more properly but I think you should rename those methods to not collapse with the behaviour in the base class...

On Wed, Jul 4, 2018 at 8:16 PM [hidden email] <[hidden email]> wrote:
I wrong.......

the error is relative to my root  class  ...

For this class i implemented the class method 

propertyAt: aKey ifAbsent: aBlock

This is in conflict with :

the Behavior  originalName  method  implement:

^ (( self isObsolete and:[ self name beginsWith: 'AnObsolete ............


where  isObsolete   TClass   is:

self propertyAt: #obsolete ifAbsent: false

Thanks for considerations,

Dario

Ciao,

i work to port some code from Pharo 4.0 to Pharo 6.1-64.

My root class into Pharo 4.0 define the properties

instance variable and some relative method:

a) propertyAt: aKey ifAbsent: aBlock

^ self properties at: aKey ifAbsent: aBlock

b) propertyAt: aKey ifAbsentPut: aBlock

^ self properties at: aKey ifAbsentPut: aBlock

c) propertyAt: aKey put: aValue

^ self properties at: aKey put: aValue

d)......

Now when i port this code into the Pharo 6.1-64 when compile the code

the Behavior originalName method implement:

^ (( self isObsolete and:[ self name beginsWith: 'AnObsolete ............


where isObsolete   TClass   is:

self propertyAt: #obsolete ifAbsent: false


But my class implement a specific propertyAt: ifAbsent:   method

and the system generates errors and  don't compile the code.


Thank you for every consideration.

Dario







--

   

Guille Polito

Research Engineer

Centre de Recherche en Informatique, Signal et Automatique de Lille

CRIStAL - UMR 9189

French National Center for Scientific Research - http://www.cnrs.fr


Web: http://guillep.github.io

Phone: +33 06 52 70 66 13

Reply | Threaded
Open this post in threaded view
|

Re: Code porting to Pharo 6.1-64

Marcus Denker-4


On 5 Jul 2018, at 09:40, Guillermo Polito <[hidden email]> wrote:

Hi Dario,

Have you defined those methods in the class side?

      a) propertyAt: aKey ifAbsent: aBlock
               ^ self properties at: aKey ifAbsent: aBlock
      b) propertyAt: aKey ifAbsentPut: aBlock
               ^ self properties at: aKey ifAbsentPut: aBlock
      c) propertyAt: aKey put: aValue
               ^ self properties at: aKey put: aValue

I will let Marcus answer more properly but I think you should rename those methods to not collapse with the behaviour in the base class...


Yes, we added a general property API to classes. This is used for e.g. tagging classes when they are obsolete (instead of relying in the name).

It can be used for other things, too. (the same as we have a property API on CompiledMethod, first class Variables and AST Nodes).

Marcus