Metanool questions

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Metanool questions

Stéphane Ducasse
Doru


Question1
---------
I would like to save the annotations (and annotation creation) with a model.
Do you have an idea where to start looking for?
Because so far I'm puzzled since this is a Magritte description of FameEntity.


Question2
--------
I have a question why  FM3Element does not have a magritteDescription but description? should I fix it because even if we use pragma I prefer when this is regular.

FM3Element >>descriptionName
        <magritteDescription>
        ^ MAStringDescription new
                accessor: #name;
                default: 'noname';
                label: 'Name';
                priority: 100;
                beRequired;
                yourself


FM3PropertyDescription>>magritteDescriptionType
        <magritteDescription>
        ^ MASingleOptionDescription new
                accessor: #type;
                label: 'Type';
                priority: 300;
                default: FM3 boolean;
                beRequired;
                options: {FM3 number .  FM3 string . FM3 boolean};
                yourself


Question3
---------
FM3 number returns an AnonymousClass.

I saw that FM3 number create a FM3MetaDescription which describes a class.
I'm not sure that I need to add new species may be boolean, string and number are enough. Now I would like to change the an Anonymous in the UI a least.

I suggest that we create an instance of a subclass of Class (I called it FM3AnonymousClass) so that we can customize the printing and other behavior the way we want.
I did it but changing printOn: in such class is not invoked so I'm confused (but now I understand but still I found that confusing).


FM3MetaDescription>>numberClass

        | class |
        class := Class new.
        class superclass: self.
        class setFormat: self format.
        class methodDictionary: MethodDictionary new.
        class methodDictionary at: #isPrimitive put: (self methodDictionary at: #anonymousReturnTrue).
        class setName: 'AnonymousClass'.
        ^class

Do you know the relationship between such anonymous classes and FM3etaDescrption?
The class comment does not say much on that :(

When I read the code I guess that FM3 is a subclass of FM3MetaDescription (not sure that the superclass is FM3MetaDescription or FM3MetaDescription class), now I do not know what is the real advantages compared to have real subclasses of FM3MEtaDescription (besides being cool and yes we can do it syndrome).

Now what confused me was that
FM3 number superclass is FM3Object and I got it

FM3MetaDescription>>number

        number isNil ifTrue: [
                number := self numberClass basicNew.
                number initialize.
                number name: #Number.
                ].
        ^number


For changing the printOn: method I imagine that it should be put in the

        class methodDictionary at: #printOn: put: (self methodDictionary at: #anonymousPrintOn:).

booleanClass

        | class |
        class := FM3AnonymousClass new.
        class superclass: self.
        class setFormat: self format.
        class methodDictionary: MethodDictionary new.
        class methodDictionary at: #isPrimitive put: (self methodDictionary at: #anonymousReturnTrue).
        class methodDictionary at: #printOn: put: (self methodDictionary at: #anonymousPrintOn:). <-------
        class setName: 'AnonymousClass'.
        ^class

but it means that to define it in FM3MetaDescription. But so far it did not work… I will try again.

I have problem to see the added value to recreate an independent class and metaclass core?

Stef

       












_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Metanool questions

Stéphane Ducasse
I tried to understand that may be I could customized the MAdescription to render the object differently but I failed too :(

I think that I found something that could be improved.

magritteDescriptionInstanceFor: aType
        | instance |
        instance := MAStringDescription new
                beReadonly;
                yourself.
        self isMultivalued ifTrue: [^ instance].

        aType = FM3 boolean ifTrue: [ instance := MABooleanDescription new ].
        aType = FM3 string ifTrue: [ instance := MAStringDescription new ].
        aType = FM3 number ifTrue: [ instance := MANumberDescription new ].
        ^ instance

=>

magritteDescriptionInstanceFor: aType
        | instance |
        instance := MAStringDescription new
                beReadonly;
                yourself.
        self isMultivalued ifTrue: [^ instance].

        aType = FM3 boolean ifTrue: [ ^ MABooleanDescription new ].
        aType = FM3 string ifTrue: [^ MAStringDescription new ].
        aType = FM3 number ifTrue: [ ^ MANumberDescription new ].
        ^ instance

but this does not solve my problem

On Apr 9, 2012, at 10:11 PM, Stéphane Ducasse wrote:

> Doru
>
>
> Question1
> ---------
> I would like to save the annotations (and annotation creation) with a model.
> Do you have an idea where to start looking for?
> Because so far I'm puzzled since this is a Magritte description of FameEntity.
>
>
> Question2
> --------
> I have a question why  FM3Element does not have a magritteDescription but description? should I fix it because even if we use pragma I prefer when this is regular.
>
> FM3Element >>descriptionName
> <magritteDescription>
> ^ MAStringDescription new
> accessor: #name;
> default: 'noname';
> label: 'Name';
> priority: 100;
> beRequired;
> yourself
>
>
> FM3PropertyDescription>>magritteDescriptionType
> <magritteDescription>
> ^ MASingleOptionDescription new
> accessor: #type;
> label: 'Type';
> priority: 300;
> default: FM3 boolean;
> beRequired;
> options: {FM3 number .  FM3 string . FM3 boolean};
> yourself
>
>
> Question3
> ---------
> FM3 number returns an AnonymousClass.
>
> I saw that FM3 number create a FM3MetaDescription which describes a class.
> I'm not sure that I need to add new species may be boolean, string and number are enough. Now I would like to change the an Anonymous in the UI a least.
>
> I suggest that we create an instance of a subclass of Class (I called it FM3AnonymousClass) so that we can customize the printing and other behavior the way we want.
> I did it but changing printOn: in such class is not invoked so I'm confused (but now I understand but still I found that confusing).
>
>
> FM3MetaDescription>>numberClass
>
> | class |
> class := Class new.
> class superclass: self.
> class setFormat: self format.
> class methodDictionary: MethodDictionary new.
> class methodDictionary at: #isPrimitive put: (self methodDictionary at: #anonymousReturnTrue).
> class setName: 'AnonymousClass'.
> ^class
>
> Do you know the relationship between such anonymous classes and FM3etaDescrption?
> The class comment does not say much on that :(
>
> When I read the code I guess that FM3 is a subclass of FM3MetaDescription (not sure that the superclass is FM3MetaDescription or FM3MetaDescription class), now I do not know what is the real advantages compared to have real subclasses of FM3MEtaDescription (besides being cool and yes we can do it syndrome).
>
> Now what confused me was that
> FM3 number superclass is FM3Object and I got it
>
> FM3MetaDescription>>number
>
> number isNil ifTrue: [
> number := self numberClass basicNew.
> number initialize.
> number name: #Number.
> ].
> ^number
>
>
> For changing the printOn: method I imagine that it should be put in the
>
> class methodDictionary at: #printOn: put: (self methodDictionary at: #anonymousPrintOn:).
>
> booleanClass
>
> | class |
> class := FM3AnonymousClass new.
> class superclass: self.
> class setFormat: self format.
> class methodDictionary: MethodDictionary new.
> class methodDictionary at: #isPrimitive put: (self methodDictionary at: #anonymousReturnTrue).
> class methodDictionary at: #printOn: put: (self methodDictionary at: #anonymousPrintOn:). <-------
> class setName: 'AnonymousClass'.
> ^class
>
> but it means that to define it in FM3MetaDescription. But so far it did not work… I will try again.
>
> I have problem to see the added value to recreate an independent class and metaclass core?
>
> Stef
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Metanool questions

Tudor Girba-2
In reply to this post by Stéphane Ducasse
Hi,

On 9 Apr 2012, at 22:11, Stéphane Ducasse wrote:

> Doru
>
>
> Question1
> ---------
> I would like to save the annotations (and annotation creation) with a model.
> Do you have an idea where to start looking for?
> Because so far I'm puzzled since this is a Magritte description of FameEntity.

They should already be saved. A Metanool annotation is a subclass of FM3PropertyDescription, and thus, they are treated as regular properties. Magritte is used only for rendering.


> Question2
> --------
> I have a question why  FM3Element does not have a magritteDescription but description? should I fix it because even if we use pragma I prefer when this is regular.
>
> FM3Element >>descriptionName
> <magritteDescription>
> ^ MAStringDescription new
> accessor: #name;
> default: 'noname';
> label: 'Name';
> priority: 100;
> beRequired;
> yourself

Yep. I will fix this.

> FM3PropertyDescription>>magritteDescriptionType
> <magritteDescription>
> ^ MASingleOptionDescription new
> accessor: #type;
> label: 'Type';
> priority: 300;
> default: FM3 boolean;
> beRequired;
> options: {FM3 number .  FM3 string . FM3 boolean};
> yourself
>
>
> Question3
> ---------
> FM3 number returns an AnonymousClass.
>
> I saw that FM3 number create a FM3MetaDescription which describes a class.
> I'm not sure that I need to add new species may be boolean, string and number are enough. Now I would like to change the an Anonymous in the UI a least.
>
> I suggest that we create an instance of a subclass of Class (I called it FM3AnonymousClass) so that we can customize the printing and other behavior the way we want.
> I did it but changing printOn: in such class is not invoked so I'm confused (but now I understand but still I found that confusing).
>
>
> FM3MetaDescription>>numberClass
>
> | class |
> class := Class new.
> class superclass: self.
> class setFormat: self format.
> class methodDictionary: MethodDictionary new.
> class methodDictionary at: #isPrimitive put: (self methodDictionary at: #anonymousReturnTrue).
> class setName: 'AnonymousClass'.
> ^class
>
> Do you know the relationship between such anonymous classes and FM3etaDescrption?
> The class comment does not say much on that :(
>
> When I read the code I guess that FM3 is a subclass of FM3MetaDescription (not sure that the superclass is FM3MetaDescription or FM3MetaDescription class), now I do not know what is the real advantages compared to have real subclasses of FM3MEtaDescription (besides being cool and yes we can do it syndrome).
>
> Now what confused me was that
> FM3 number superclass is FM3Object and I got it
>
> FM3MetaDescription>>number
>
> number isNil ifTrue: [
> number := self numberClass basicNew.
> number initialize.
> number name: #Number.
> ].
> ^number
>
>
> For changing the printOn: method I imagine that it should be put in the
>
> class methodDictionary at: #printOn: put: (self methodDictionary at: #anonymousPrintOn:).
>
> booleanClass
>
> | class |
> class := FM3AnonymousClass new.
> class superclass: self.
> class setFormat: self format.
> class methodDictionary: MethodDictionary new.
> class methodDictionary at: #isPrimitive put: (self methodDictionary at: #anonymousReturnTrue).
> class methodDictionary at: #printOn: put: (self methodDictionary at: #anonymousPrintOn:). <-------
> class setName: 'AnonymousClass'.
> ^class
>
> but it means that to define it in FM3MetaDescription. But so far it did not work… I will try again.
>
> I have problem to see the added value to recreate an independent class and metaclass core?

Indeed. I do not quite grasp everything here either.

Cheers,
Doru


> Stef
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev

--
www.tudorgirba.com

"There are no old things, there are only old ways of looking at them."




_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev