Hi ...
I don't really see how the different MAaccesor work... as I'm always using MASelector... For instance, what could be the use of MADictionnaryAccesor ? MAVariableAccesor ? (used in MADescription class) MAContainerAccessor ? ... Are they always linked to real instance variables (created) ? Thanks Cédrick I _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Smallwiki mailing list [hidden email] http://impara.de/mailman/listinfo/smallwiki |
Cédrick Béler a écrit :
> Hi ... > > I don't really see how the different MAaccesor work... as I'm always > using MASelector... Do you use last Magritte version ? There is comments in the MAAccessor classes now. > For instance, what could be the use of MADictionnaryAccesor ? This one expects a dictionary as the model and a key to create the accessor. #read: is equivalent to #at: on dictionaries while #write:to: is equivalent to #at:put:. > MAVariableAccesor ? (used in MADescription class) MAVariableAccessor is used only as a convenience constructor in MADescription in fact. It access directly a variable of the model passed to #write:to: or #read. You'd better use MASelectorAccessor or MAAutoSelectorAccessor. > MAContainerAccessor ? This one is not supposed to write. And when used for reading, it answers the model given as the argument. > Are they always linked to real instance variables (created) ? Not at all. Only MAVariableAccessor use instance variables directly. MASelectorAccessor does not require a variable, it can store in a database for example or something else that fit your needs. -- Damien Cassou CSS3 : "On passe au HSL, plus intuitif et moins orienté CRT que le RGB. Il y a du HSLA". Et en plus, ça veut dire quelque chose (au moins pour l'auteur) ! _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Smallwiki mailing list [hidden email] http://impara.de/mailman/listinfo/smallwiki |
In reply to this post by cbeler
> I don't really see how the different MAaccesor work... as I'm always
> using MASelector... Don't worry, this is fine. It is probably the accessor to be used in 95% of the cases. > For instance, what could be the use of MADictionnaryAccesor ? If you have a dictionaries with your values ... e.g. a property dictionary with different key and value pairs. > MAVariableAccesor ? (used in MADescription class) I've never used it, but it is cool to have ;-) > MAContainerAccessor ? It is used internally by Magritte. It is the same as: MASelectorAccessor read: #yourself (this is also read-only) > Are they always linked to real instance variables (created) ? No, as Damien said they can be dynamically calculated, fetched from a database, dispatched to other objects, etc. Cheers, Lukas -- Lukas Renggli http://www.lukas-renggli.ch _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Smallwiki mailing list [hidden email] http://impara.de/mailman/listinfo/smallwiki |
Actually, I think I might need one so I m trying to understand how it works.For instance, what could be the use of MADictionnaryAccesor ?If you have a dictionaries with your values ... e.g. a property dictionary with different key and value pairs. I'd like to do somethink like that: experience event:= 'avalanche'. temperature := #( #value->25 #analyses-> #(1 0) ) activity := #(#value->anActivity #analyses-> #(1 0.8) ) ... It's a way to add analyses element to an experience (on their attributes) I'd like to use a MADictionaryAccesor to manage to build description to have a simple editor and viewer "like if" my experience object was: experience event:= 'avalanche'. temperature := 25 activity := anActivity but also, the same one in readonly + editor on analyses element (2 text fields) I tryed a bit today but I'll look at that deeper tomorow. Is it a case where MADictionaryAccessor could be useful ? (I hope I'm clear enough ;)) and so they can be seen as extra-information on an object defined in squeak ?Are they always linked to real instance variables (created) ?No, as Damien said they can be dynamically calculated, fetched from a database, dispatched to other objects, etc. see you :) Cédrick _______________________________________________ SmallWiki, Magritte, Pier and Related Tools ... https://www.iam.unibe.ch/mailman/listinfo/smallwiki _______________________________________________ Smallwiki mailing list [hidden email] http://impara.de/mailman/listinfo/smallwiki |
Free forum by Nabble | Edit this page |