On Sat, Sep 12, 2015 at 2:26 AM, Marcus Denker <marcus.denker@inria.fr> wrote:
On 11 Sep 2015, at 20:05, Hernán Morales Durand <hernan.morales@gmail.com> wrote:
I saw some interesting reflection progress in Pharo 5. I wonder if there is a feature to rank instance variables. For example, from the browser I want to assign a category "important" to an instance variable, or "possibly useless", etc. for later refactorings.
Is such thing "easily" possible now? There is API support from Reflectivity maybe?
The infrastructure is there⦠we can annotate instance variables.
(Point slotNamed: #x) propertyAt: #note put: 'useless'. (Point slotNamed: #x) propertyAt: #note
One could build a user interface around that.
Properties are not saved with monticello, though. They are like method properties. So one would need to build something on top...
Another idea would be to make a subclass of InstanceVariableSlot that stores the note in a property but it is actually part of the slot definition:
Object subclass: #Point slots: { #x => InstanceVariableWithNote note: âthis is uselessâ. #y } classVariables: { } category: 'Kernel-BasicObjects'
As the note is part of the slot definition, it would be saved in Monticello.
(unrelated: I still am tempted to just use the term âinstance variableâ and get rid of the term Slot.. for the paper is was nice, but now? Especially as we have slot like first class ClassVars and Globals that nevertheless are not slotsâ¦)
Could you expand on how ClassVars and Globals are slot-like but not slots. One *tiny* consideration in favour of "slot" is that its more concise that "instance variable". Actually in post I often abbreviate to "iv" or "ivar". Also, would it be fair to say that for most programming languages variables are "dead", and it might be good to distinguish the "liveness" of slots. Further, there may be a particular class of early adopters who upon hearing the term "slot" that they don't know, will be compelled to investigate btw, can temporary variables be Slots? cheers -ben