[GUI] get and set

Krasimir Angelov ka2_mail@yahoo.com
Mon, 17 Feb 2003 15:37:44 -0800 (PST)


--- Sven Panne <Sven.Panne@informatik.uni-muenchen.de>
wrote:
> * It's a bit strange that a class with a "get"
> method is called
>    "Readable". "HasGetter" or "Gettable" would look
> more consistent to
>    me, but I'm not a native speaker.

   I just follow definitions given from Daan:

--- Daan Leijen wrote:
> Furthermore, you can still make a read/write 
> distinction by putting "get" and ":=" in classes as
> you do:
> 
> class Readable attr where
>   get :: attr w a -> w -> IO a
> class Writable attr where
>   (=:) :: attr w a -> a -> Prop w

But maybe you are right HasGetter and HasSetter are
more adequate names. I don't have any preferences
about names.

> * A list version of (=:) is missing (called "set" in
> GIO/HOpenGL). But
>    even its type wouldn't be clear to me given this
> general version of
>    (=:). Hmmm...

With new implementation the HOpenGL's set function is
just well known sequence_ function from the standard
prelude. The GIO's set function correspond to setp
function from the Attr module.

> That was my intention. We should probably move this
> thread to the
> libraries list and continue discussion there (e.g.
> naming, where
> should the classes and instances reside in the
> module hierarchy,
> etc.).

Well! I expect future discussion in the
libraries@haskell.org. I propose to extract the type
classes in the new module (maybe
Control.Monad.Attributes) and after that to add 
attribute types along with their instances to modules 
which defines corresponding monads.

> Krasimir: Do you want to propose your Attr module
> there (without the
> GIO/HOpenGL stuff, of course)? It's your baby, after
> all...

Of course. The attributes can be used in much more 
places than in GIO and HOpenGL. The good example is 
HToolkit Draw monad. There are many functions like 
(get/set)PenColor, (get/set)PenSize which can be
replaced with attributes of type PenAttr.

Cheers,
Krasimir

__________________________________________________
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
http://shopping.yahoo.com