Hi Simon,
First, let me sum up what I understood from the past/current state in Meta and Moose.
In Meta there was some kind of support for generic access (by symbol) to property described by pragmas. This support went as far as providing different SelectorStrategy to compute getter/setter for a property.
Now in Moose, there is a cache system on top of that. In particular since properties are read only, there are computed once and stored. The cache seems to work in two ways:
- when you make a direct call to a method computing a property, good
behaviour for the method is to ask the cache and provides a block to initialize the value in case it is missing
- when you access the property through its symbolic name, it will
look for it in the cache and in case it is not there, request it using a SelectorStrategy, which will in the end call the above method (repeat process above)
Note that the second case can result in two cache miss, but this is just a minor remark.
The fact is, the cache is built on top of the metamodel, but it should not be a concern of the metamodel.
The propertyNamed: cache mechanism is not the concern of the meta- model. It is the concern of each object, and it is the object that decide to compute something based on the information from the meta- description. The meta-model does not know anything about such a mechanism.
I do not see why this would be wrong.
In any case, propertyNamed: was a method used heavily long time ago, when we did not have methods for each property. So, most of the code in Moose does not depend on it anymore. However, it is still convenient to call it from the conformity strategies.
OK, enough rambling, back to the topic of pragmas. The attributes declared by those pragmas should be described with FM3Property, right? It makes good sense to me, in particular since we could then request the attributes for their value using #getFrom:
So we could declare such an attribute using <MSEProperty: #NOM type: ....>.
Then there is custom annotations to such attributes using specific pragmas, like you propose: <MSEAnnotation: #longName value: 'pimp my meta-model'> <MSEAnnotation: #description value: 'Yo dawg, I herd you like models so we put ...'>
I think such specific annotations should be stored in FM3Element, with accessors. Also there should be a mean to query enclosed elements based on such annotations, like: I should be able to ask a FM3MetaDescription for all its attributes which declare a 'description' annotation.
In Moose/Meta we subclassed Property with a class that has longName and description fields, and we had a specialized PragmaProcessor that knew how to read those annotations. I agree that there these classes did not have much behavior, but it was easier to grasp. Annotations linked to meta Properties can be an overkill for the matter at hand. On the other hand, if Annotations could be attached to any Element, this could be a nice way to comment the meta-model.
Cheers, Doru
On 10 déc. 08, at 00:00, Adrian Kuhn wrote:
Hi Simon,
As I understand you have "custom attributes" in your metamodel and want to specify them using pragmas. Further you would like Fame to parse and handle these pragmas.
I dont have a solution ready for this. Which is not a surprise, Fame grows only when need arises. Do you have suggestions how to solve it? What would be best for your need?
Would something alonge these lines help you:
<MSEAnnotation: #longName value: 'pimp my meta-model'> <MSEAnnotation: #description value: 'Yo dawg, I herd you like models so we put ...'>
cheers, AA
-- Follow me http://twitter.com/akuhn
On 08.12.2008, at 12:16, Simon Denier wrote:
Hi
I was wondering how some pragmas should be handled in Moose? Apparently there is currently two "kind" of pragmas in use: the ones which begin with MSESomething are used to describe the model in Fame. But there is also a range of "property:longName:description:" pragmas which are used to describe entity properties like "numberOfMethods", "numberOfAccesses"...
Such pragmas allow a generic mean to access some metrics, using MooseEntity#propertyNamed: But the implementation of #propertyNamed: relies on attributes which should be described in the metamodel.
Now it seems that the responsibility to parse and interpret those pragmas belongs to Fame. Currently they are not handled, and I just found a TODO note in FM3MetaDescription#attributeNamed:ifAbsent:
-- Simon
-- Simon
Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com www.tudorgirba.com/blog
"To lead is not to demand things, it is to make them happen."