[Haskell-cafe] Interesting Thread on OO Usefulness (scala mailing list)

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Thu May 7 04:56:00 EDT 2009


Am Dienstag, 5. Mai 2009 18:39 schrieb Bulat Ziganshin:
> Hello Wolfgang,
>
> Tuesday, May 5, 2009, 8:27:17 PM, you wrote:
> >> i know two problems in Haskell/GHC that require OO-loke features -
> >> extensible exceptions and GUI widget types hierarchy
> >
> > Note that you don’t need different types for different kinds of GUI
> > widgets if you use Functional Reactive Programming (FRP). You need
> > different types if you use OO because you have to explicitely modify
> > widgets after you have created them, and what modifications you are
> > allowed to do, depends on the kind of widget. With FRP, you specify the
> > behavior over all time when you create the widget, so no need for later
> > method calls.
>
> (i don't know anything about FRP)
>
> i think it doesn't change anything. the main reason why i need common
> operations is because i write generic procedures. another erason os
> what i can't remember 100 individual 'setSize' operations for 100
> types of widgets. so we need to have some generic names, short of they
> are used due initialization or later

Yes, you need generic names also with FRP. The difference is that with OO, 
every property (e.g., size) corresponds to a pair of methods (setSize, 
getSize) while in FRP every property correspond to an input (or a parameter 
of the constructor if you think in OO terms). So with FRP, you need some kind 
of record system, preferably with the possibility to extend records. At 
least, this is the solution I use in Grapefruit.

Best wishes,
Wolfgang


More information about the Haskell-Cafe mailing list