Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Functional programming does not work

Name: Anonymous 2009-12-30 2:17

An insightful post! I await your analysis, professoroi.

http://prog21.dadgum.com/54.html

Name: Anonymous 2009-12-30 2:28

Name: Anonymous 2009-12-30 3:18

Imagine you've implemented a large program in a purely functional way. All the data is properly threaded in and out of functions, and there are no truly destructive updates to speak of. Now pick the two lowest-level and most isolated functions in the entire codebase. They're used all over the place, but are never called from the same modules. Now make these dependent on each other: function A behaves differently depending on the number of times function B has been called and vice-versa.

Ah, the hazards of writing your program before you design it.

Name: Anonymous 2009-12-30 3:23

This is why I believe one should design functions in a functional manner, regardless of the language used, but when state is required, state should be used. Functional programming does make testing simpler and programs easier to debug, however I never understand the appeal of purely functional programming, except for those that want to parallelize their application with ease.

Name: Anonymous 2009-12-30 3:24

Ah, the hazards of ever wanting to modify the slightest detail in your program's design.

Name: Anonymous 2009-12-30 3:35

so yer "functional programming" is utter bullshit.
introduction of artifical restrictions with no profit at all.
all hopes entrusted to "lazy programming" and "automatic parallelization" didn't justify themselves.
a human does this better than a machine.

Name: Anonymous 2009-12-30 3:40

¡An insightful post ˙I await your analysis ‘professoroi

Name: Anonymous 2009-12-30 3:43

>>6
It's not utter bullshit. It helps greately to design your functions in a functional manner, but you should only do that as long as it doesn't get in your way. Designing your functions to behave in a functional manner is possible in any language, from Assembler to C to Lisp to *insert any language with procedural abstractions*. You should only use global state when needed and when it makes sense. The usefulness of purely functional programming may be questioned, but nobody is questioning the benefit of designing functions to behave in a functional manner.

Name: Anonymous 2009-12-30 5:26

>>6
Functional programming != Lazy Programming. Scheme , Erlang and ML are all eagerly evaluated. Even SPJ admitted that eagerness is the better default.

Automatic parallelization is still mostly a myth.

The restrictions are there to allow you to reason about your programs better, and let's face it, if my function depends only on it's parameters instead of some global state it is going to be a hell of a lot easier to test.

Name: Anonymous 2009-12-30 5:43

The thing about functional programming is that small pure functions can be easily be proven correct by virtue of being small. By composing complex pure functions from simple functions, we can greatly reduce the amount of time and effort needed to complete them.

Name: =+=*=F=R=O=Z=E=N==V=O=I=D=*=+= !frozEn/KIg 2009-12-30 11:39

http://prog21.dadgum.com/21.html
By this point I'm sure I've offended most of the BlitzMax and PowerBASIC users out there, and to everyone else it looks like I'm gleefully making fun of Blub programmers. I may be looking down my snooty language dilettante nose at them, yes, but from a get-things-done productivity point of view I'm seriously impressed. There's a continuous stream of games written in BlitzMax, games that are more than just retro-remakes of 8-bit relics, from people with very little programming experience. There are games with physics, games with elaborate effects, 3D games written with libraries designed for 2D, games written over the course of spring break. I'm withholding judgement on the raw aesthetics and playability of these games; the impressive part is that they exist and are largely written by people with minimal programming background. (I've downloaded more than one BlitzMax game that came with source code and marveled at how the entire core of the project was contained in a single 1000+ line function.)


___________________________________________
http://bayimg.com/image/iafhbaacj.jpg
«You have a tendency to feel you are superior to most computers. »

Name: HMA 2009-12-30 12:39

>>10
You are a retard vomiting back the posts of whatever FP kool-aid drinking blogger you read. You have no measurable experience in functional programming.

Let's say you build a compiler in Haskell. All functions are pure, except of course main which is in an IO monad. Now, tell me how exactly you're going to 'easily prove correct' anything at all.

Name: not->>10 2009-12-30 12:51

>>12
Designing functions to only depend on their input and have well-designated output(s), and which usually don't change their input has proven a useful rule of the thumb for me, regardless of programming language. It does help a lot when testing. While most of us don't use lazy evaluation, currying, and fancy closure tricks too often, the design principles lead to more robust programs in general. Such style of programming also fits well with bottom-up programming in languages which support interactive development. I don't know if there's that much high-level impact, but it helps a lot when it comes to the bulk of the code. I tend to whip up some imperative things sometimes when it comes to interconnecting components, while keeping simpler components designed in a functional style.
I don't claim that anything is "provably" correct, since the languages I tend to use are C and Lisp, however if I were to use Haskell or ML(which I do know to some degree), you could say that a whole class of typing errors are removed, but that does nothing to protect against human logic errors, which are much more dangerous and tricky overall. If you actually want to "prove" that the application does what you want it to do, it's possible to do it in some cases via theorem provers, but the process always seemed very tedious to me, and in most cases a waste of effort unless someone pays you to do it, or is a requirement of the project.

Name: Anonymous 2011-02-02 22:47

Name: Anonymous 2011-02-03 2:36

Name: Anonymous 2011-02-04 17:33

Name: Anonymous 2011-02-04 19:59

Don't change these.
Name: Email:
Entire Thread Thread List