I'm slowly making my mind around such issues.
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.
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.
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