On 10 May 2018, at 21:59, Guillermo Polito <guillermopolito@gmail.com> wrote:Just be careful, that privateState thing looks like a Moose only Famix feature. It't not available in plain Pharo objects :)On Wed, May 9, 2018 at 2:09 AM, Alidra Abdelghani via Pharo-users <pharo-users@lists.pharo.org> wrote:
---------- Forwarded message ----------
From: Alidra Abdelghani <alidrandco@yahoo.fr>
To: Pavel Krivanek <pavel.krivanek@gmail.com>
Cc: Any question about pharo is welcome <pharo-users@lists.pharo.org>
Bcc:
Date: Wed, 9 May 2018 01:09:06 +0100
Subject: Re: Package extension. Adding instance variables to classesHi Pavel,Thank you for your answer.I actually didn���t know about this mechanism.I think it is will do the job :)I have probably to rewrite some parts pf my code to access my variables through privateState. no?Thanks againAbdelghaniOn 07 May 2018, at 13:15, pharo-users-request@lists.pharo.org wrote:
Message: 1
Date: Mon, 7 May 2018 13:43:56 +0200
From: Pavel Krivanek <pavel.krivanek@gmail.com>
To: Any question about pharo is welcome <pharo-users@lists.pharo.org>
Subject: Re: [Pharo-users] Package extension. Adding instance
variables to classes
Message-ID:
<CAHN2FzeMiBL4Y8asJ0XCjS2AQdxycoN+pbc+Hsd=trMnmuiJqw@mail. >gmail.com
Content-Type: text/plain; charset="utf-8"
2018-05-07 12:25 GMT+02:00 Alidra Abdelghani via Pharo-users <
pharo-users@lists.pharo.org>:
---------- P?eposlan? zpr?va ----------
From: Alidra Abdelghani <alidrandco@yahoo.fr>
To: pharo-users@lists.pharo.org
Cc:
Bcc:
Date: Mon, 7 May 2018 11:25:49 +0100
Subject: Package extension. Adding instance variables to classes
Hi,
I am working on a package named ClassNamesAnalyzer and I need to add code
to third party classes in other packages (for instance the FAMIX-Core
package).
?Extending? third party classes with methods is easy; I just need to
categorise my methods under the *ClassNamesAnalyzer protocole so that
loading my package will load them in the image.
However, if I want to add instance variables to theses classes, they are
not there when I load the package in a new image.
*So my question is* : is there a way to include instance variables
addition to other packages in my package?
Currently not, you should use privateState*Another question is* : is it good practice to add instance variables to
classes in third party packages and is there a way to avoid it (because I
am not very confortable with that idea)?
It is not, see FAMIXContainerEntity>>#definedAnnotationTypes how this issue
is currently being solved using the privateState.
Cheers,
-- Pavel
Thanks in advance,
Abdelghani
--
Guille PolitoResearch Engineer
Centre de Recherche en Informatique, Signal et Automatique de LilleCRIStAL - UMR 9189French National Center for Scientific Research - http://www.cnrs.frPhone: +33 06 52 70 66 13