News for hackers. Stuff that matters.
Re:Why I Prefer Functional Programming by marcosdumay on Saturday October 31, 2020 @12:14PM (#24952635)
Haskell is famous for having problems with space leaks, where the runtime just refuses to evaluate your code and keeps storing more of it to run later. It's not usually a problem because people will teach you how to avoid most of it on any introductory text (usually, it's not hard), but if no care is taken, it will happen.

To go into another timeless paradigm, logical programming is famous for unexpected exponential execution times. It's rare that those get past tests, but it's something that developers are constantly having to fix (this or ensuring the type system detects determinism). SQL has a much milder version or this with underspecified joins.

Getting ride of time makes a lot of things easier, but is not trouble-free.

Re:Why I Prefer Functional Programming by YeGoblynQueenne on Saturday October 31, 2020 @07:40PM (#24956171)
>> To go into another timeless paradigm, logical programming is famous for unexpected exponential execution times.

I have never heard of those famous "unexpected exponential times" in logic (not "logical") programming. Could you please give an example of what you mean?

I'm also not sure what you mean by "this or ensuring the type system detects determinism". What logic programming languages with a type system do you mean? Why would a type system be required to detect determinism?

Re:Why I Prefer Functional Programming by samcal on Saturday October 31, 2020 @12:25PM (#24952728)
I really like that distinction, relating imperative/FP tradeoffs to the classic space/time tradeoff. I'd also point out that betting on space getting cheaper over time seems like a better bet than betting on time getting cheaper :)
Re:Why I Prefer Functional Programming by marcosdumay on Saturday October 31, 2020 @01:21PM (#24953279)
That's not the trade-off. The trade-off is about what you have to think about when programming, and what kinds of bugs appear.

Non-buggy performance follows different rules.

Re:Why I Prefer Functional Programming by UncleMeat on Monday November 02, 2020 @07:44AM (#24967529)
Is time better? My experience with Haskell went like this.

1. Interested in Haskell. Learn the language, read papers, enjoy the PL concepts and interesting academic work.

2. Does it scale? Implement small program in in C++ and Haskell. Optimize as best I can. Talk to people who work on ghc who happen to be in my lab. Further optimize. Everybody agrees, no further clear way to optimize the Haskell program.

C++ implementation remains several orders of magnitude faster.

If it were a time and space trade off, laziness would lead to good performance. But it doesn’t. It tends to produce stupendously bad cache behavior.

Haskell is a lovely platform for understanding some recent PL theory. It is possible to write the sort of obviously correct programs that make it so desirable.

It isn’t resource efficient. Worse, laziness means that performance tends to be chaotic. Small seemingly unrelated changes can change the execution order and change your profile a lot. Similar challenges exist in logical programming.