Hi,
Last month we did some changes to the MM generator of the development
version of Moose and it might impact people using it.
I'll explain the changes and what to do in this mail.
Context:
In the development version of Moose, we have two ways of building a
metamodel. The first is to do as in Moose 6.1 and write it by hand.
The second and recommended way is to describe it in a MetaModel
generator and to generate it.
This generator is also able to regenerate a metamodel. In order to do
that, it needs to know the Traits and Slots it generated. This was
done by generating two methods on each entity: #generatedSlotNames and
#generatedTraitNames.
Changes:
With Julien Delplanque, we updated Moose to remove the need of those
two methods. For Traits, we are now able to just ask an entity for its
Traits that are part of the metamodel. Thus, we do not need the
#generatedTraitNames method. For Slots, we have two kinds. One that
describe a relation between entities and another that store
properties. The relations already had a slot specific to Famix. We
introduced another one call FMProperty to be used to store the
properties. With that change, all slots generated by the generator are
specific to Famix, thus we can lust ask a class for its famix slots
and we do not need to generate a static method with the slot names in
entities.
Actions to take after this change:
We added some compatibility code to keep things working during a
transition period. Two actions are needed if you want a clean MM after
those changes:
- The first one is to remove the #generatedTraitNames methods from the
class side of generated entities.
- The second one is to regenerate your metamodel and this will
automatically replace InstanceVariableSlot by FMProperty and remove
#generatedSlotNames methods.
Change in generator behavior:
This change as a side effect you need to know. Before, regeneration of
MM was updating only the Traits and Slots it generated. Now it will
regenerate all Traits that are part of the metamodel (with a
#MSEClass:super pragma) and all Famix slots. Thus, if you are managing
a MM via a generator, you need to update the generator description to
add a Trait or Slot from Famix instead of adding it by hand. Else, it
will be removed during the next generation.
--
Cyril Ferlicot
https://ferlicot.fr