auto accessor and suggested types

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

auto accessor and suggested types

Philippe Marschall
Hi

Have you ever used an auto accessor and been annoyed by the fact that
the suggested type of the mutators argument is 'anObject'? I mean we
have a description that has a kind, so why not a suggested type? The
problem is that an accessor doesn't know to what description it
belongs. So is there a way around this? Yes, we can look at the first
argument in #write:to:. However, only doing

'a', anObject class name

Will not work. For booleans this will either result in 'aTrue' or
'aFalse'. Other cases that have to be taken care of are:
- Strings
- Symbols
- Numbers
- Collections (expect dictionaries, but I don't think they are not
supported by Magritte)
- (Pier) structures
additionally we need to take nil into account.

So it may be a better idea to implement #suggestedType in various classes.

Opinions?

Cheers
Philippe

_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki
Reply | Threaded
Open this post in threaded view
|

Re: auto accessor and suggested types

Lukas Renggli-2
> So it may be a better idea to implement #suggestedType in various  
> classes.
>
> Opinions?

Personally, I prefer anObject as argument because it is always  
correct. As soon as you start to change your application (and this  
happens a lot during prototyping with #auto: accessors), suddenly the  
type might be wrong and does not change anymore. Therefor I think it  
is not worth the trouble.

Cheers,
Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch



_______________________________________________
SmallWiki, Magritte, Pier and Related Tools ...
https://www.iam.unibe.ch/mailman/listinfo/smallwiki