Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26

Thread: Functional Programming languages - Better?

  1. #11
    Join Date
    Aug 2007
    Beans
    949

    Re: Functional Programming languages - Better?

    Haskell is actually extremely fast, performing in some benchmarks close to C. Admittedly, in benchmarks that are designed to test imperative or object oriented languages, this tends to be the case.

    The reason is that the Haskell's pure functionality makes it easy to implement very good optimizations, including lazy evaluations and memoization, which compilers like gcc can't do for C.

    Saying that functional languages are performance-bound isn't really true. Functional languages are just different, and in the cases of things like Haskell or Scheme, I think that academics get too carried away with the purity of the language or minimalism, not really paying attention to things like readable syntax or practicality. Common Lisp is a different story -- unfortunately, good compilers for CL are hard to come by.
    Last edited by soltanis; April 15th, 2010 at 07:17 AM.

  2. #12
    Join Date
    Aug 2006
    Location
    60°27'48"N 24°48'18"E
    Beans
    3,458

    Re: Functional Programming languages - Better?

    Quote Originally Posted by Cracauer View Post
    OOP as such is actually not that great for many things. OOP in a language with a lack of const strictness, much less one with dynamic typing only can be real trouble. It's really not that hot anymore, it will just do what made it popular in the first place: better than nothing.
    It's just the static-typed OOP that essentially forces all those design patterns into existence -- you need to define even more types to jump through hoops. One of the major culprits to this is also single dispatch -- the insane idea that a method, that in an OOP language needs to be associated to data, is actually "owned" by a single type (or descendants) and the method is resolved only by the "this" object. It's a mad restriction, that CLOS fortunately does away with.

    I don't get the dynamic-typing issue -- everything is an object, and the interface of the object is simply implicit, or can be investigated during runtime. Even CL is dynamically typed by default as you know...

    Broadly taken, OOP is quite pervasive in all kinds of programming.

    However, claims that functional programming will take over are just bogus, and have been bogus since about 1960, unchanged. It's not gonna happen, acceptance and performance are just not there.
    May not be that we'll all be coding FP in the future, but you must admit that the simple need to reduce communication between parallel threads whether it is on different cores or machines will greatly benefit from FP strategies.


    But it wouldn't be such a valuable experience if you just used Lisp to do sideeffect heavy programming, because it will let you.
    Well, if we allow performance-related arguments... pure-functional style (Common) Lisp seems to cons like hell most of the time. And of course in CL you lose the provability guarantees you get in pure-FP.

    Of course, I'm with you in the "it lets you do any kind of programming" sentiment in general, as I said above too. It's good to see how these things relate, and Lisp makes that clearer.

    If you want to stretch your mind then something purer and statically typed might be a choice.
    Haskell's type system is an interesting thing in its own right, and the reason why such static-typedness actually works there is the referential transparency -- the compiler can see a piece of data being declared, and because references never change their referents, can follow that piece of data through the code most of the time, inferring types. Haskell thus behaves almost as a dynamic-typed language most of the time, while not being one.

    The comparison to your regular static-typed imperative language is interesting... annotating types is mostly an exercise where you just tell the compiler something you already know (I'm not a big believer in the theory that it actually prevents errors at compile-time). When a language is not as strongly inferrable the compiler is reduced to just crying when you make a mistake -- and ludicrously the language is such that the compiler is still able to mostly tell you what is wrong, but you are the one that needs to satisfy it although it almost could do it by itself.

    Haskell can break through that barrier -- it's able to confidently infer a lot of stuff, and where it gets lost, it is able to tell you exactly where it is running out of information (although a bit cryptically sometimes) and then you just fill in the blank and off it goes again.

    Quote Originally Posted by soltanis View Post
    unfortunately, good compilers for CL are hard to come by.
    Is there something wrong with SBCL?
    LambdaGrok. | #ubuntu-programming on FreeNode

  3. #13
    Join Date
    Aug 2006
    Location
    Germany
    Beans
    396

    Re: Functional Programming languages - Better?

    For all who want (or will be) working on the JVM there is:
    Scala www.scala-lang.org
    combining OOP AND FP (blasphemy!), more balanced they say,quite different from OCaml
    Clojure : http://ubuntuforums.org/showthread.php?t=951509
    (Its a LISP YEAH!)
    Last edited by Shin_Gouki2501; April 15th, 2010 at 06:54 PM.
    the jvm is my home...
    http://clojure.org/
    http://www.scala-lang.org/...and it rocks a lot!

  4. #14
    Join Date
    Aug 2006
    Location
    60°27'48"N 24°48'18"E
    Beans
    3,458

    Re: Functional Programming languages - Better?

    Quote Originally Posted by Shin_Gouki2501 View Post
    combining OOP AND FP (blasphemy!)
    This is a huge misconception. FP and OOP are not in any sense mutually exclusive -- actually, object-oriented programming can be thought of falling out of storing data members in closures and returning them from there according to some selector key that is passed into the function.

    In addition, many/most FP languages implicitly have their data items as "objects" of some type, and then, depending on the dispatching mechanism, the function/method gets chosen according to that. Object-orientedness is not just a Java/C++/C# thing.
    LambdaGrok. | #ubuntu-programming on FreeNode

  5. #15
    Join Date
    Dec 2009
    Beans
    82

    Re: Functional Programming languages - Better?

    I am reading this thread I see something like C vs C++ in its essence.

    FP vs OOP has had its debate for years. I have learned both forms since I began programming in 1982. Each has it advantages and disadvantages. It all comes down to preference of programming styles and implementation ease in the various languages.

    Certian OOP langauges have tried to simplify the abstracts of programming, which I personally take for granted. I am not a fan of Java or C# because of this lazy approach to programming. Forgive me I learned Intel based Assembly at one time.

    I still love to program in c and c++, with a splash of assembly. I learned the old line numbered approach to basic and Old styles of pascal before I ventured into OPP approaches of Pascal and C/C++. (one of the books I have on my shelf is called moving from c to C++.)

    You need to know FP forms of programming to do OOP forms but the access and deviations are different. As far as I know most of the languages out there try to make implementation of these ideas simpler and harder in some cases.

    Sorry if I put my 2cents in with my experiences.

  6. #16
    Join Date
    Aug 2006
    Location
    Germany
    Beans
    396

    Re: Functional Programming languages - Better?

    Quote Originally Posted by CptPicard View Post
    This is a huge misconception. FP and OOP are not in any sense mutually exclusive -- actually, object-oriented programming can be thought of falling out of storing data members in closures and returning them from there according to some selector key that is passed into the function.

    In addition, many/most FP languages implicitly have their data items as "objects" of some type, and then, depending on the dispatching mechanism, the function/method gets chosen according to that. Object-orientedness is not just a Java/C++/C# thing.
    Yes Scala for example is much more OOP than Java : http://en.wikipedia.org/wiki/Scala_%...ented_features
    and still has a lot nice FP features.
    the jvm is my home...
    http://clojure.org/
    http://www.scala-lang.org/...and it rocks a lot!

  7. #17
    Join Date
    Aug 2006
    Location
    60°27'48"N 24°48'18"E
    Beans
    3,458

    Re: Functional Programming languages - Better?

    Quote Originally Posted by azagaros View Post
    FP vs OOP has had its debate for years.
    But one needs to remember that FP's roots tend to be more theoretical, whereas OOP (as in it's C++-style implementations) has arisen more from the practical need of having an extensible type system with ability to associate operations with said types. What has held back FP's widespread adoption have been performance issues and just frankly programmer inability to grasp the concepts...

    It all comes down to preference of programming styles and implementation ease in the various languages.
    I would venture a claim that the things that make FP languages what they are are objectively speaking qualitatively different in the sense that they are worth learning; it's not all just a matter of preference.

    Certian OOP langauges have tried to simplify the abstracts of programming, which I personally take for granted. I am not a fan of Java or C# because of this lazy approach to programming.
    I wonder if you mean the machine-specifics... it is interesting how the meaning of "abstract" seems to be completely opposite for different people. Assembly is at least from my POV very "concrete", but if I'm building a cathedral, it's the architectural blueprints that are important, not the rocks it's made of.

    Forgive me I learned Intel based Assembly at one time.
    Well, likewise -- just can't help noticing the high-level language vs. low-level language mindset seems interestingly irreconcilable. It's just an interesting thing I've noticed.

    You need to know FP forms of programming to do OOP forms
    I am not sure what you mean by this. Most OOP programmers I know couldn't program their own small object system in Scheme if they tried. I am actually getting the impression that you're confusing structured/procedural programming with functional programming...
    LambdaGrok. | #ubuntu-programming on FreeNode

  8. #18
    Join Date
    Dec 2009
    Beans
    82

    Re: Functional Programming languages - Better?

    FP and its own abstraction. I had to look up this set of concepts to get what I may have never learned.

    Starting here for some basics of what I didn't understand.
    http://en.wikipedia.org/wiki/Functional_programming

    Most programmers never learn these abstractions. I learned some of them over the 20 years of programming when I had a need for the concept in the programming process. I didn't have problems understanding the concepts.

    Getting accurate reals in an abstraction is how the bits are managed and sorted out, which can be accomplished in any language I have been associated with as long as I can manage the processor reasonably well, which most of the libraries I found stemming from that article did do.

    Type checking and none type checking the basic of the void pointer in c with simple idea of type casting as you mathematically across the computer. The oddities of writing an OS.

  9. #19
    Join Date
    Dec 2006
    Beans
    Hidden!

    Re: Functional Programming languages - Better?

    Quote Originally Posted by azagaros View Post
    FP and its own abstraction. I had to look up this set of concepts to get what I may have never learned.

    Starting here for some basics of what I didn't understand.
    http://en.wikipedia.org/wiki/Functional_programming

    Most programmers never learn these abstractions. I learned some of them over the 20 years of programming when I had a need for the concept in the programming process. I didn't have problems understanding the concepts.

    Getting accurate reals in an abstraction is how the bits are managed and sorted out, which can be accomplished in any language I have been associated with as long as I can manage the processor reasonably well, which most of the libraries I found stemming from that article did do.

    Type checking and none type checking the basic of the void pointer in c with simple idea of type casting as you mathematically across the computer. The oddities of writing an OS.
    Huh?
    What the hell are you talking about?!

    (Hint: it makes no sense... It's not even related to the topic of this discussion...)

  10. #20
    Join Date
    Dec 2006
    Beans
    Hidden!

    Re: Functional Programming languages - Better?

    Quote Originally Posted by CptPicard View Post
    But one needs to remember that FP's roots tend to be more theoretical, whereas OOP (as in it's C++-style implementations) has arisen more from the practical need of having an extensible type system with ability to associate operations with said types. What has held back FP's widespread adoption have been performance issues and just frankly programmer inability to grasp the concepts...
    Quit dancing around Captain.

    Answer this: why are programmers unable to grasp the "functional" paradigm? It is because our brains are naturally "procedural", "object-oriented", or what?

    Is it simply a matter of which paradigm we were exposed first?


    I am not sure what you mean by this. Most OOP programmers I know couldn't program their own small object system in Scheme if they tried. I am actually getting the impression that you're confusing structured/procedural programming with functional programming...
    LOL! He is totally missing the point.

    Actually, I think we've seen this before, people confusing "functional" with "procedural".

    A lot of people have the wrong conception that because "C" has functions, it must be a "functional language". Perhaps, a new term need to be used for functional languages to avoid this sort of confusion. What about calling them "lambda languages" or another fancy term?

Page 2 of 3 FirstFirst 123 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •