www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - The Downfall of Imperative Programming

reply Mirko Pilger <pilger cymotec.de> writes:
i guess this might be of interest to some.

http://fpcomplete.com/the-downfall-of-imperative-programming/

http://www.reddit.com/r/programming/comments/s112h/the_downfall_of_imperative_programming_functional/
Apr 09 2012
next sibling parent reply Gour <gour atmarama.net> writes:
On Mon, 09 Apr 2012 22:28:01 +0200
Mirko Pilger <pilger cymotec.de> wrote:

 i guess this might be of interest to some.
Yes, it is...and I wonder if D's FP features are good enough? Author mentions D, but says:"...This is all good, but not enough..." Sincerely, Gour --=20 Everyone is forced to act helplessly according to the qualities=20 he has acquired from the modes of material nature; therefore no=20 one can refrain from doing something, not even for a moment. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Apr 09 2012
parent Caligo <iteronvexor gmail.com> writes:
The Haskell version of Romans, rubies and D:

Modified version of http://www.haskell.org/haskellwiki/Roman_numerals
so that it's compile time.


---------------->8---------------->8----------------
module Romans where

import Language.Haskell.TH
import Maybe


roman :: String -> ExpQ
roman s = return $ LitE (IntegerL (value s))
  where value = fromIntegral . fst
                . foldr (\p (t,s) -> if p >= s then (t+p,p) else (t-p,p)) (0,0)
                . map (fromJust . flip lookup (zip "IVXLCDM"
[1,5,10,50,100,500,1000]))
----------------8<----------------8<----------------


And actual usage:

---------------->8---------------->8----------------


import Romans

main = print $(roman "VIX")
----------------8<----------------8<----------------


I still like the D version though.
Apr 11 2012
prev sibling next sibling parent reply Sean Cavanaugh <WorksOnMyMachine gmail.com> writes:
On 4/9/2012 3:28 PM, Mirko Pilger wrote:
 i guess this might be of interest to some.

 http://fpcomplete.com/the-downfall-of-imperative-programming/

 http://www.reddit.com/r/programming/comments/s112h/the_downfall_of_imperative_programming_functional/
I would counter a flow based programming approach solves a lot of the same concurrency problems and doesn't tie you to a programming style for the actual code (functional vs declarative) as each module can be made to do whatever it wants or needs to do.
Apr 09 2012
next sibling parent reply "Froglegs" <lugtug gmail.com> writes:
   I like functional languages, but the only one that seems to 



  I've used TBB Flow Graph in C++ and found it to be a major 
improvement over straight parallel algorithms/tasks/message 
passing etc which seem to be the norm(like in D).  Expressing 
dependencies between separate nodes was super easy.



   Do any other languages have support for flow based concurrency 
like C++/TBB?
Apr 09 2012
parent reply Paulo Pinto <pjmlp progtools.org> writes:
No really.

Scala, Clojure and Ocaml also do have quite industry support already.
Actually on my job, any client would pick one of those over D, as they
are slowly being accepted in enterprise projects.

A curious fact is that the FP fans have much to thank to Microsoft, as
it is the company with more FP research on their paychecks. Many open
source fans are not aware that a few of the main developers in the Ocaml 
and Haskell communities, work for Microsoft Research labs.

--
Paulo

Am 10.04.2012 02:25, schrieb Froglegs:
 I like functional languages, but the only one that seems to have much



 I've used TBB Flow Graph in C++ and found it to be a major improvement
 over straight parallel algorithms/tasks/message passing etc which seem
 to be the norm(like in D). Expressing dependencies between separate
 nodes was super easy.



 Do any other languages have support for flow based concurrency like
 C++/TBB?
Apr 10 2012
next sibling parent reply Gour <gour atmarama.net> writes:
On Tue, 10 Apr 2012 18:06:37 +0200
Paulo Pinto <pjmlp progtools.org> wrote:

 Scala, Clojure and Ocaml also do have quite industry support already.
How does the GUI world of Ocaml look like? Sincerely, Gour --=20 According to the three modes of material nature and the work=20 associated with them, the four divisions of human society are=20 created by Me. And although I am the creator of this system,=20 you should know that I am yet the nondoer, being unchangeable. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Apr 10 2012
parent reply "bls" <bls orange.fr> writes:
On Tuesday, 10 April 2012 at 16:30:34 UTC, Gour wrote:
 On Tue, 10 Apr 2012 18:06:37 +0200
 Paulo Pinto <pjmlp progtools.org> wrote:

 Scala, Clojure and Ocaml also do have quite industry support 
 already.
How does the GUI world of Ocaml look like? Sincerely, Gour
GTK
Apr 10 2012
parent reply Gour <gour atmarama.net> writes:
On Tue, 10 Apr 2012 19:01:07 +0200
"bls" <bls orange.fr> wrote:

 GTK
Then, D is better even in that regard. ;) Sincerely, Gour --=20 Whenever and wherever there is a decline in religious practice,=20 O descendant of Bharata, and a predominant rise of irreligion =E2=80=94=20 at that time I descend Myself. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Apr 10 2012
parent "Paulo Pinto" <pjmlp progtools.org> writes:

GUIs.


while


This approach seems to cater more for the business audience, as to


--
Paulo

On Tuesday, 10 April 2012 at 17:42:24 UTC, Gour wrote:
 On Tue, 10 Apr 2012 19:01:07 +0200
 "bls" <bls orange.fr> wrote:

 GTK
Then, D is better even in that regard. ;) Sincerely, Gour
Apr 10 2012
prev sibling parent reply Jeff Nowakowski <jeff dilacero.org> writes:
On 04/10/2012 12:06 PM, Paulo Pinto wrote:
 A curious fact is that the FP fans have much to thank to Microsoft, as
 it is the company with more FP research on their paychecks. Many open
 source fans are not aware that a few of the main developers in the Ocaml
 and Haskell communities, work for Microsoft Research labs.
I don't see any reason to thank Microsoft for this so much as to be wary of it. The same people that were getting paid to work on this stuff at universities in Europe, where software patents don't exist, are now getting paid to work at Microsoft, where patenting software is expected as part of the job. Microsoft has also in recent years been very aggressive with their patent portfolio, rattling their saber at Linux and suing Android distributors.
Apr 12 2012
parent reply "Paulo Pinto" <pjmlp progtools.org> writes:
On Thursday, 12 April 2012 at 13:36:41 UTC, Jeff Nowakowski wrote:
 On 04/10/2012 12:06 PM, Paulo Pinto wrote:
 A curious fact is that the FP fans have much to thank to 
 Microsoft, as
 it is the company with more FP research on their paychecks. 
 Many open
 source fans are not aware that a few of the main developers in 
 the Ocaml
 and Haskell communities, work for Microsoft Research labs.
I don't see any reason to thank Microsoft for this so much as to be wary of it. The same people that were getting paid to work on this stuff at universities in Europe, where software patents don't exist, are now getting paid to work at Microsoft, where patenting software is expected as part of the job. Microsoft has also in recent years been very aggressive with their patent portfolio, rattling their saber at Linux and suing Android distributors.
And yet IBM still is the number one champion in patents. Or just, because they play nice most of the time with open source they are excused? Patents are bad, regardless which company makes use of them.
Apr 12 2012
next sibling parent "H. S. Teoh" <hsteoh quickfur.ath.cx> writes:
On Thu, Apr 12, 2012 at 05:02:36PM +0200, Paulo Pinto wrote:
 On Thursday, 12 April 2012 at 13:36:41 UTC, Jeff Nowakowski wrote:
[...]
Microsoft has also in recent years been very aggressive with their
patent portfolio, rattling their saber at Linux and suing Android
distributors.
And yet IBM still is the number one champion in patents. Or just, because they play nice most of the time with open source they are excused? Patents are bad, regardless which company makes use of them.
All big companies are guilty of patent squatting. I distrust all of them. The bottomline is, once a company grows big enough, it acquires all sorts of vested interests in making more money, and retaining its position to be able to do so. Patent squatting is especially popular among contemporary high-tech companies. They essentially have no choice because they have to answer to their stakeholders. Only startups and grassroots companies have the chance of being decent in this respect. T -- I think the conspiracy theorists are out to get us...
Apr 12 2012
prev sibling parent Jeff Nowakowski <jeff dilacero.org> writes:
On 04/12/2012 11:02 AM, Paulo Pinto wrote:
 And yet IBM still is the number one champion in patents.

 Or just, because they play nice most of the time with open source they
 are excused?
I don't know why you are talking about IBM. Maybe you should reread my post. I'm talking about Microsoft because you brought them up.
Apr 12 2012
prev sibling parent reply James Miller <james aatch.net> writes:
* Sean Cavanaugh <WorksOnMyMachine gmail.com> [2012-04-09 16:09:03 -0500]:
 On 4/9/2012 3:28 PM, Mirko Pilger wrote:
i guess this might be of interest to some.

http://fpcomplete.com/the-downfall-of-imperative-programming/

http://www.reddit.com/r/programming/comments/s112h/the_downfall_of_imperative_programming_functional/
I would counter a flow based programming approach solves a lot of the same concurrency problems and doesn't tie you to a programming style for the actual code (functional vs declarative) as each module can be made to do whatever it wants or needs to do.
On top of that, while functional languages are cool, they tend to fall down when you have to write more complex programs. I've seen Haskell code that it incredibly verbose, simply because of it functional nature. Pure functional is great, until you need a usable program, because eventually you will want IO, and IO is unpure, you cannot predict it. The better way is to have more of a sandbox model. IO and the like are managed by a single thread (per object, so per file etc), that recieves commands (I don't care how) to do things. Everything else is written however you want, functional, imperative, declarative, whatever. You then make all memory thread-local, no global memory at all, except through a specific, controlled system that carefully controls access. Ideally this system would only be used to pass around very large data structures between threads. This way, you get the advantages of pure functional, but don't miss the advantages of mutable variables and being able to write in the imperative style. Slightly OT: With the unstoppable march of parallel programming, does anybody else find node.js incredibly infuriating, since it is single-core. -- James Miller
Apr 09 2012
parent reply Marco Leise <Marco.Leise gmx.de> writes:
Am Tue, 10 Apr 2012 12:50:32 +1200
schrieb James Miller <james aatch.net>:

 Slightly OT: With the unstoppable march of parallel programming, does
 anybody else find node.js incredibly infuriating, since it is
 single-core.
Don't blame the library. EcmaScript was designed to be single-core. I imagine that web scripting language to be much more complex with multi-threading in user code. You are using the wrong tool for the job ;) -- Marco
Apr 09 2012
parent reply James Miller <james aatch.net> writes:
* Marco Leise <Marco.Leise gmx.de> [2012-04-10 05:57:52 +0200]:

 Am Tue, 10 Apr 2012 12:50:32 +1200
 schrieb James Miller <james aatch.net>:
 
 Slightly OT: With the unstoppable march of parallel programming, does
 anybody else find node.js incredibly infuriating, since it is
 single-core.
Don't blame the library. EcmaScript was designed to be single-core. I imagine that web scripting language to be much more complex with multi-threading in user code. You are using the wrong tool for the job ;) -- Marco
I meant that the fact that node.js is gaining popularity, despite the fact that we want to move away from single-threaded applications, is incredibly backwards. I'm not using node, I have to use PHP at work, which at the very least gets help from the webserver in terms of parallel processing. -- James Miller
Apr 10 2012
parent =?UTF-8?B?IlPDtm5rZQ==?= Ludwig" <sludwig_ _outerproduct.org> writes:
On Tuesday, 10 April 2012 at 10:38:28 UTC, James Miller wrote:
 * Marco Leise <Marco.Leise gmx.de> [2012-04-10 05:57:52 +0200]:

 Am Tue, 10 Apr 2012 12:50:32 +1200
 schrieb James Miller <james aatch.net>:
 
 Slightly OT: With the unstoppable march of parallel 
 programming, does
 anybody else find node.js incredibly infuriating, since it is
 single-core.
Don't blame the library. EcmaScript was designed to be single-core. I imagine that web scripting language to be much more complex with multi-threading in user code. You are using the wrong tool for the job ;) -- Marco
I meant that the fact that node.js is gaining popularity, despite the fact that we want to move away from single-threaded applications, is incredibly backwards. I'm not using node, I have to use PHP at work, which at the very least gets help from the webserver in terms of parallel processing. -- James Miller
I haven't used it, but node.js has clusters (http://nodejs.org/docs/v0.6.0/api/cluster.html) which often should be just as good. But performing I/O using single-threaded asynchronous I/O instead of threaded blocking I/O is a huge win in terms of performance - it would just be nice to have threading on top to do the number crunching work.
Apr 10 2012
prev sibling parent reply "Kagamin" <spam here.lot> writes:
On Monday, 9 April 2012 at 20:22:30 UTC, Mirko Pilger wrote:
 http://fpcomplete.com/the-downfall-of-imperative-programming/
--- All data is immutable. All functions are pure. You might think this is crazy — how can you program with such stifling restrictions? It turns out that people have been doing just that for a long time. In fact the most popular language for parallel and distributed programming is Erlang — a functional language. An even better candidate for parallel programming is Haskell, which supports a large variety of parallel paradigms. --- http://flyingfrogblog.blogspot.com/2008/08/haskells-virginity.html Oookay.
Apr 10 2012
parent reply Russel Winder <russel winder.org.uk> writes:
Two quite interesting points to make here:

1.  OCaml has a GIL and so, like CPython (*), is forced to use operating
system processes to obtain parallelism. Also OCaml has imperative
features, it is not a pure functional language.  Clojure followed this
route as well, using STM to deal with locking issues.

2. Haskell is a lazy language which means:
	a. it can work with infinite data structures; and
	b. it is incredibly difficult to create parallel codes.

Simon Peyton Jones and Simon Marlow have had to do a great deal of very
clever work to make Data Parallel Haskell, but it is to Haskell what
NumPy is to Python.=20

I am a fan of declarative expression, I prefer functional approaches
over explicitly imperative ones.  For the moment though using single
assignment in imperative languages with all the lambda/closure
technology and using functional programming thinking is the best

tiny bit part players for a long while.

On the JVM the interesting question is whether Clojure finally makes
Lisp a mainstream language outside of one or two domains.


(*) PyPy is experimenting with STM to replace use of a GIL.
--=20
Russel.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder ekiga.n=
et
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
Apr 10 2012
next sibling parent reply "Paulo Pinto" <pjmlp progtools.org> writes:
My favourite FP language is Haskell, but I doubt most "code
monkeys"
will ever be able to grasp it, while impure ones are more
approachable
in enterprise environments.

The issues you point out are actually more implementation
issues than language related, right?

--
Paulo

On Tuesday, 10 April 2012 at 17:19:00 UTC, Russel Winder wrote:
 Two quite interesting points to make here:

 1.  OCaml has a GIL and so, like CPython (*), is forced to use 
 operating
 system processes to obtain parallelism. Also OCaml has 
 imperative
 features, it is not a pure functional language.  Clojure 
 followed this
 route as well, using STM to deal with locking issues.

 2. Haskell is a lazy language which means:
 	a. it can work with infinite data structures; and
 	b. it is incredibly difficult to create parallel codes.

 Simon Peyton Jones and Simon Marlow have had to do a great deal 
 of very
 clever work to make Data Parallel Haskell, but it is to Haskell 
 what
 NumPy is to Python.

 I am a fan of declarative expression, I prefer functional 
 approaches
 over explicitly imperative ones.  For the moment though using 
 single
 assignment in imperative languages with all the lambda/closure
 technology and using functional programming thinking is the best

 remain
 tiny bit part players for a long while.

 On the JVM the interesting question is whether Clojure finally 
 makes
 Lisp a mainstream language outside of one or two domains.


 (*) PyPy is experimenting with STM to replace use of a GIL.
Apr 10 2012
parent reply Gour <gour atmarama.net> writes:
On Tue, 10 Apr 2012 20:19:13 +0200
"Paulo Pinto" <pjmlp progtools.org> wrote:

 My favourite FP language is Haskell, but I doubt most "code
 monkeys" will ever be able to grasp it, while impure ones are more
 approachable in enterprise environments.
That's right...I tried with Haskell, liked its syntax a lot, but was not sure I really grokked monads. Moreover, I lost few potential contributors because of insisting on Haskell. Now, I hope to get some of the FP features by using Haskell and have easier time not to think about unsafePerformIO & co. :-) Sincerely, Gour --=20 The senses, the mind and the intelligence are the sitting places=20 of this lust. Through them lust covers the real knowledge of the=20 living entity and bewilders him.
Apr 10 2012
parent reply Russel Winder <russel winder.org.uk> writes:
On Tue, 2012-04-10 at 20:46 +0200, Gour wrote:
[...]
 That's right...I tried with Haskell, liked its syntax a lot, but was not
 sure I really grokked monads. Moreover, I lost few potential
[...] The biggest problems with monads are that most imperative programmers think they are some massive high magic that is incomprehensible to mere mortals, and most functional programmers think they are simple and that they understand them. Monads are just things with a couple of methods of certain signatures and that have behaviour not unrelated to continuations. If you get higher order functions, currying and partial evaluation, then monads come naturally (*). (*) But only once they were initially thought of as programming entities rather than some aspect of Category Theory. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Apr 10 2012
parent reply Gour <gour atmarama.net> writes:
On Tue, 10 Apr 2012 20:13:45 +0100
Russel Winder <russel winder.org.uk> wrote:

 The biggest problems with monads are that most imperative programmers
 think they are some massive high magic that is incomprehensible to
 mere mortals, and  most functional programmers think they are simple
 and that they understand them.
Indeed.
 If you get higher order functions, currying and partial evaluation,
 then monads come naturally (*).
I believe I got HoFs, currying & partial evolution, but maybe I was missing (*) In any case, as it is often said, I got a feeling that despite its potential cleanliness, the real-world Haskell code was not so readable. By deploying some coding discipline, we tend to believe that D can serve well as FP-language for the masses. :-) Sincerely, Gour --=20 When your intelligence has passed out of the dense forest=20 of delusion, you shall become indifferent to all that has=20 been heard and all that is to be heard. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Apr 10 2012
next sibling parent reply Russel Winder <russel winder.org.uk> writes:
On Tue, 2012-04-10 at 21:22 +0200, Gour wrote:
[...]
 In any case, as it is often said, I got a feeling that despite its
 potential cleanliness, the real-world Haskell code was not so readable.
That probably comes down to familiarity and personal taste.
 By deploying some coding discipline, we tend to believe that D can serve
 well as FP-language for the masses. :-)
Hummm... the really core issue is whether the language supports tail call optimization. Functional programming languages demand it, C, C++, Java, Go, Python definitely don't have it, D... --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel winder.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Apr 10 2012
next sibling parent Gour <gour atmarama.net> writes:
On Tue, 10 Apr 2012 21:02:03 +0100
Russel Winder <russel winder.org.uk> wrote:

 Hummm... the really core issue is whether the language supports tail
 call optimization.  Functional programming languages demand it, C,
 C++, Java, Go, Python definitely don't have it, D...
Isn't it because they have to use recursion instead of iteration? Sincerely, Gour --=20 As the ignorant perform their duties with attachment to results,=20 the learned may similarly act, but without attachment, for the=20 sake of leading people on the right path. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Apr 10 2012
prev sibling parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 4/10/12 3:02 PM, Russel Winder wrote:
 Hummm... the really core issue is whether the language supports tail
 call optimization.  Functional programming languages demand it, C, C++,
 Java, Go, Python definitely don't have it, D...
D has only the tail recursion, not the tail call. The latter should be easy to implement. Andrei
Apr 10 2012
parent reply =?UTF-8?B?QWxleCBSw7hubmUgUGV0ZXJzZW4=?= <xtzgzorex gmail.com> writes:
On 10-04-2012 23:02, Andrei Alexandrescu wrote:
 On 4/10/12 3:02 PM, Russel Winder wrote:
 Hummm... the really core issue is whether the language supports tail
 call optimization. Functional programming languages demand it, C, C++,
 Java, Go, Python definitely don't have it, D...
D has only the tail recursion, not the tail call. The latter should be easy to implement. Andrei
One thing I think we need to do with D is actually guarantee tail calls in the situations where it makes sense. A mistake many other languages made is saying that "this may or may not be a tail call depending on the implementation". This is not enough of a guarantee to write portable programs... -- - Alex
Apr 10 2012
parent Dmitry Olshansky <dmitry.olsh gmail.com> writes:
On 11.04.2012 1:04, Alex Rønne Petersen wrote:
 On 10-04-2012 23:02, Andrei Alexandrescu wrote:
 On 4/10/12 3:02 PM, Russel Winder wrote:
 Hummm... the really core issue is whether the language supports tail
 call optimization. Functional programming languages demand it, C, C++,
 Java, Go, Python definitely don't have it, D...
D has only the tail recursion, not the tail call. The latter should be easy to implement. Andrei
One thing I think we need to do with D is actually guarantee tail calls in the situations where it makes sense. A mistake many other languages made is saying that "this may or may not be a tail call depending on the implementation". This is not enough of a guarantee to write portable programs...
+1 Let me correct your last statement: "it may overflow stack or not depending on the implementation" -- Dmitry Olshansky
Apr 10 2012
prev sibling parent reply James Miller <james aatch.net> writes:
* Russel Winder <russel winder.org.uk> [2012-04-10 21:02:03 +0100]:

 On Tue, 2012-04-10 at 21:22 +0200, Gour wrote:
 [...]
 In any case, as it is often said, I got a feeling that despite its
 potential cleanliness, the real-world Haskell code was not so readable.
That probably comes down to familiarity and personal taste.
 By deploying some coding discipline, we tend to believe that D can serve
 well as FP-language for the masses. :-)
Hummm... the really core issue is whether the language supports tail call optimization. Functional programming languages demand it, C, C++, Java, Go, Python definitely don't have it, D...
I used Haskell a bit a while back, and while I enjoyed using it, and was quite capable of writing in proper functional style, I found reasoning about the programs tedious and difficult. Due to the nature of "Everything is a function" (mostly), you end up with an incredible amount of functions for the simplest tasks. And some of the most common tasks in real-world programming, string processing and IO, are significantly more difficult in Haskell. Monads aren't a problem, the discussion of monads, by functional programmers is a problem. The moment some snobby functional programmer comes along and starts talking about category theory and some esoteric aspect of Type Algebra generalized of some field of Assholery, most people's brains turn off. It gets worse when you go: "How does this help read from a file" and they give you a long stare and start all over again, I just want to know how to read from a goddamn file! I wish I could love Haskell, and for pure computer science, it's fine, amazing even, but for real-world programming, it just doesn't cut it. The concepts are too difficult and not explained well enough, code rapidly becomes unreadable unless you maintain super-human discipline and broken code is difficult to fix. Case in point is darcs, which is a perfect application of real-word usage, and the GHC developers are complaining of it being unstable, bloated and impossible to fix, so they are moving to git (written in C no less). -- James Miller
Apr 12 2012
next sibling parent reply "bearophile" <bearophileHUGS lycos.com> writes:
James Miller:

 I wish I could love Haskell, and for pure computer science, 
 it's fine, amazing even, but for real-world programming,
 it just doesn't cut it.
Haskell contains some ideas worth copying even in non-functional languages (or in mixed languages as D). Enforced purity and immutability, lazy immutable lists, pattern matching, tuples and their various unpacking syntax, list comprehension, structural algebraic types, built-in currying and partial application, and so on, are handy and allow to express certain computing idioms in a succinct and clear way (and not every part of a program needs the same runtime efficiency). Scala language shows that you can put several of those things in a language that supports mutability too. Bye, bearophile
Apr 12 2012
next sibling parent reply Gour <gour atmarama.net> writes:
On Thu, 12 Apr 2012 15:14:37 +0200
"bearophile" <bearophileHUGS lycos.com> wrote:

 Haskell contains some ideas worth copying even in non-functional=20
 languages (or in mixed languages as D).
What do you miss in D from Haskell? Sincerely, Gour --=20 To deliver the pious and to annihilate the miscreants,=20 as well as to reestablish the principles of religion,=20 I Myself appear, millennium after millennium. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Apr 12 2012
parent "bearophile" <bearophileHUGS lycos.com> writes:
Gour:

 What do you miss in D from Haskell?
It's written a bit below in my post:
 lazy immutable lists, pattern matching, tuples and their
 various unpacking syntax, list comprehension, structural
 algebraic types, built-in currying and partial application
I am about to write a post about one of those. Bye, bearophile
Apr 12 2012
prev sibling parent James Miller <james aatch.net> writes:
* bearophile <bearophileHUGS lycos.com> [2012-04-12 15:14:37 +0200]:

 James Miller:
 
I wish I could love Haskell, and for pure computer science, it's
fine, amazing even, but for real-world programming,
it just doesn't cut it.
Haskell contains some ideas worth copying even in non-functional languages (or in mixed languages as D). Enforced purity and immutability, lazy immutable lists, pattern matching, tuples and their various unpacking syntax, list comprehension, structural algebraic types, built-in currying and partial application, and so on, are handy and allow to express certain computing idioms in a succinct and clear way (and not every part of a program needs the same runtime efficiency). Scala language shows that you can put several of those things in a language that supports mutability too. Bye, bearophile
I like Scala, didn't really get it when I first looked at it, but that was a while ago, and I have learned Haskell since then, so I might give it another look. As I said, Haskell is a fine language, and the features are very useful. My favorites are: partial function application, currying, list comprehension and lazy lists. There are others, but these are things that I miss the most from my time using Haskell -- James Miller
Apr 12 2012
prev sibling next sibling parent Gour <gour atmarama.net> writes:
On Thu, 12 Apr 2012 23:04:16 +1200
James Miller <james aatch.net> wrote:

 I wish I could love Haskell, and for pure computer science, it's fine,
 amazing even, but for real-world programming, it just doesn't cut it.
 The concepts are too difficult and not explained well enough, code
 rapidly becomes unreadable unless you maintain super-human discipline
 and broken code is difficult to fix.=20
I'm glad I'm not the only one arriving at the same conclusion. Sincerely, Gour --=20 To deliver the pious and to annihilate the miscreants,=20 as well as to reestablish the principles of religion,=20 I Myself appear, millennium after millennium. http://atmarama.net | Hlapicina (Croatia) | GPG: 52B5C810
Apr 12 2012
prev sibling parent "Paulo Pinto" <pjmlp progtools.org> writes:
Well, all these guys seem to disagree with you about using 
Haskell in
real-world programming

http://corp.galois.com/
http://www.eaton.com/Eaton/index.htm
http://blog.tupil.com/


--
Paulo

On Thursday, 12 April 2012 at 11:04:06 UTC, James Miller wrote:
 * Russel Winder <russel winder.org.uk> [2012-04-10 21:02:03 
 +0100]:

 On Tue, 2012-04-10 at 21:22 +0200, Gour wrote:
 [...]
 In any case, as it is often said, I got a feeling that 
 despite its
 potential cleanliness, the real-world Haskell code was not 
 so readable.
That probably comes down to familiarity and personal taste.
 By deploying some coding discipline, we tend to believe that 
 D can serve
 well as FP-language for the masses. :-)
Hummm... the really core issue is whether the language supports tail call optimization. Functional programming languages demand it, C, C++, Java, Go, Python definitely don't have it, D...
I used Haskell a bit a while back, and while I enjoyed using it, and was quite capable of writing in proper functional style, I found reasoning about the programs tedious and difficult. Due to the nature of "Everything is a function" (mostly), you end up with an incredible amount of functions for the simplest tasks. And some of the most common tasks in real-world programming, string processing and IO, are significantly more difficult in Haskell. Monads aren't a problem, the discussion of monads, by functional programmers is a problem. The moment some snobby functional programmer comes along and starts talking about category theory and some esoteric aspect of Type Algebra generalized of some field of Assholery, most people's brains turn off. It gets worse when you go: "How does this help read from a file" and they give you a long stare and start all over again, I just want to know how to read from a goddamn file! I wish I could love Haskell, and for pure computer science, it's fine, amazing even, but for real-world programming, it just doesn't cut it. The concepts are too difficult and not explained well enough, code rapidly becomes unreadable unless you maintain super-human discipline and broken code is difficult to fix. Case in point is darcs, which is a perfect application of real-word usage, and the GHC developers are complaining of it being unstable, bloated and impossible to fix, so they are moving to git (written in C no less). -- James Miller
Apr 12 2012
prev sibling next sibling parent "bearophile" <bearophileHUGS lycos.com> writes:
Russel Winder:

 On the JVM the interesting question is whether Clojure finally 
 makes Lisp a mainstream language outside of one or two domains.
Clojure contains some interesting programming language design ideas. I have written enough Scheme that now I am sure I don't like to write S-expressions. S-expressions are a puzzle-way to write expressions, and I'd like to avoid solving micro-puzzles all the time. I've seen that idiomatic Clojure code is too much slow for my purposes (there are ways to speed up Clojure code, but only partially and the result doesn't look good). Regarding parallelism in Clojure, I am seeing single-core C/D code faster than idiomatic Clojure running on 4 or 8 cores. I have not done enough experiments, so those are just anecdotes. Bye, bearophile
Apr 10 2012
prev sibling parent "Kagamin" <spam here.lot> writes:
On Tuesday, 10 April 2012 at 17:19:00 UTC, Russel Winder wrote:
 I am a fan of declarative expression, I prefer functional 
 approaches
 over explicitly imperative ones.  For the moment though using 
 single
 assignment in imperative languages with all the lambda/closure
 technology and using functional programming thinking is the best
 compromise.
Imperative languages only emulate functional style to some extent. They remain inherently imperative and impure. And for declarative syntax to really fly you need an FP language, purity and immutability for sure.
Apr 11 2012