[Xotcl] Functional programming?

Gustaf Neumann neumann at wu-wien.ac.at
Thu May 16 21:15:34 CEST 2002


On Thursday 16 May 2002 15:16, Rick Hedin wrote:
> Hello.  My friends are trying to convince me of the value of functional
> programming.  Writing safer and clearer programs sounds good, but I am not
> inclined to learn Haskell.
>
> Xotcl is a pretty flexible beast.  Can I do functional programming in it?
> It seems as though classes are a variety of object in Xotcl, so that will
> be an advantage for passing classes around, but what else am I missing?  I
> suspect that Gustaf and Uwe thought about functional programming when they
> designed their beast.  Can I find out what their thoughts were?

 hi rick,

 nobody can find out today, what their thoughts really were :)

 there is no exact answer to your question, here are some
 random thoughts...

 well, functional programming is quite different in principle
 from oo programming which is in turn quite different to say 
 logic programming. it's not a matter of "power" or "flexibilty",
 it's a matter, how the matter how one like to think about
 a certain problem area and what are the primary things of 
 concern ... well in theory. in practice, many of the pure
 concepts are sometimes less important.

    oo: think in things, classify things, encapsulate state,
        reuse code, build systems

    functional programming: think in expressions, purists say that
        variables are not needed, support powerful nice things 
        with funny names like "list comprehensions", "monads" etc.

    logic programming: think in logic, expressing relations between
        things (like grammars), express "truth", don't focus on
        program flow, try theories
 
 you can certainly program in a functional programming style
 in Tcl or XOTcl, but it does not make this necessarily a functional
 language. The much rumored "feather" project much more support
 in this direction. 

 i am a friend of varieties: use the right tool for the right 
 task. There are many projects that i would start today in
 e.g. C, some other in Prolog/clp(R), some in Java or whatever,
 but most in xotcl (but i am certainly not objective). 

 There is no way, we could port all nice features of all
 programming languages to xotcl, and if we would, i am not
 sure whether i would like the result. xotcl is a theme,
 a way, we proceed. There are certainly other ways as well,
 and many of these will be better suited for certain tasks.

 i would say, listen to your friends, look into haskell,
 make your own opinion, how you would like to solve your
 programming tasks, this will help you to make well-founded
 decisions.

 I have never used Haskell for anything real. The next best 
 was APL where i have written various programs; it was
 quite fun, but i a got the somewhat wrong impression 
 what computers are for (i thought a computer is primarily
 is a big, powerful calculator). Today i would say that it is 
 more important to use a computer to build systems. For this 
 task, oo is quite ok, i would say....

 hope this helps a little to make your mind up.

 greetings
-gustaf
 



More information about the Xotcl mailing list