FP Component Libraries? (FP vs OOP) 
Author Message
 FP Component Libraries? (FP vs OOP)

Dear colleagues,

we are  contemplating a revision of our course structures, and have decided
that the big theme of intro programming teaching is ``re-usability''. I am
wondering that this might *not* lead inevitably to OOP, perceiving the
following merits of FP for intro CS:

        (1) referential transparency directly supports formal methods in a
        ``real'' programming language setting ie the programs the students
        derive or verify are the ones they compile and run

        (2) greater expressive and modelling power of function-valued-functions

        (3) polymorphism

        (4) usually not much syntax

We know from recent discussions that ``FP'' (as usually understood to involve
Milner polymorhpism - 3 above) is incompatible with ``OOP'' (as usually
understood to involve inheritance/overloading) - though I'd certainly
appreciate pointers to an archive of that discussion OR your correction if
this synopsis is faulty. THEREFORE, in order to keep FP in the running for intro
teaching here, I'd like some pointers to BIG libraries of BIG components
that students use could lego-style to build interesting applications, rather
like to Booch components for Ada (and C++?) or the Smalltalk library(ies) that
exist. An extra gimmick would be if the components could be HOF ``glue'' (as
Hughes would put it) rather than simple ADTs etc.

Thanks for your early consideration - I have 2 wks to get a proposal finalised.

Paul Bailes
--

Department of Computer Science          Phone:  +61 7 365 2097
The University of Queensland QLD 4072   Fax:    +61 7 365 1999
AUSTRALIA



Tue, 02 Jul 1996 11:43:41 GMT  
 FP Component Libraries? (FP vs OOP)

How about HOL as a serious piece of software? Somewhat {*filter*}uous perhaps, since
it is about proof in an ML framework.

Since I have missed out on the OOP/Functional debate on this group,
perhaps I should not  put my oar in here, but it does seem to me that the
much of the essential apparatus of OOP is present in an FP environment - indeed
that OOP represents the discovery by the mainstream community that it is a
good idea to associate code with data, but, since they still don't know how
to do closures, they have bodged it.

Something like the SML below would seem to capture the apparatus of single-dispatch
object-orientation of  C++

datatype 'a suite = Suite of  'a -> unit;

datatype 'a obj = Ob of 'a suite * 'a;

fun printobj(Ob(Suite(p),v)) = p(v);

datatype pt = Pt of int*int;

fun conspoint(x,y) = Ob(Suite(
   fn Pt(x,y) => (print x; print y; ()) ), Pt(x,y));

datatype ln = Ln of pt obj * pt obj;

fun consline(P1,P2) = Ob(Suite(
   fn Ln(x,y) => (printobj P1; printobj P2; ()) ), Ln(P1,P2));

val P1 = conspoint(3,4);
val P2 = conspoint(5,6);
val l1 = consline(P1,P2);



Wed, 03 Jul 1996 01:39:36 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Subclassing vs Subtyping (partly OOP vs FP)

2. More than two FP-TB-3 with FP-TC-120

3. OO and FP (was subtyping in FP)

4. FP to FP Binary/Hex

5. comparison OOP and FP (and how to put them together) was: Re: need help with haskell

6. OOP => FP

7. DBC in functional languages [Was: comparison OOP and FP]

8. What language do you think is a good combination between OOP and FP

9. "FP+OOP=Haskell"

10. "FP+OOP=Haskell" paper

11. etc. FP + OOP

12. Objects with state, or FP + OOP = Haskell++

 

 
Powered by phpBB® Forum Software