Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Pure functions are a good theoretical exercise but they can't exist in practice.

Well, they can. But not all the way up to the top level of your program. But the longer you can hold off from your functions having side effects the more predictable and stable your codebase will be, with as an added benefit fewer bugs and less chance of runtime issues.





Yes, but they're "Hello world!" hostile, so traditional programming language pedagogy doesn't work well.

Q: How many Prolog programmers does it take to change a lightbulb?

A: Yes.


I imagine LLMs have already thrown traditional programming language pedagogy out the window.

Yes I agree, pure functions are good building blocks (for the most part), but I don't think the current abstractions and ways of bridging the FP and Procedural world are good enough

Also have you managed to eliminate the side effect of your IP register changing when your program is running? ;)


> but I don't think the current abstractions and ways of bridging the FP and Procedural world are good enough

I find that both Python and Javascript allow you to use functional code when appropriate, without forcing you to use it when it isn’t.


I love FP but at the end of the day registers are global variables. Half of modern compiler theory consists of workarounds for this sad truth.

A functional program is an a self-contained expression -- an isolated system following its own rules. The foremost example we have of such a thing is the universe itself, but the universe is not a good example in this discussion, because we have plenty of reasons to think that the universe contains pure (not pseudo-) randomness. Beyond that, isolation , when it matters, is not an easily proven proposition, and is a deplorable fantasy when assumed in many of the other science and engineering disciplines.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: