4 ms·
One should hope Haskel, and other functional programming evangelist come with a better element to display. The = operator is just syntax. Pascal uses :=, you co
by erez 15y ago
One should hope Haskel, and other functional programming evangelist come with a better element to display. The = operator is just syntax. Pascal uses :=, you could use ## for all the compiler care (as in x ## x + 1), or I could eschew all operators and have a x.assign(x.increment()), so no math student gets confused.
There's great power in the idea of single assign, and the notion of immutable objects (be it variables, or else) is getting many programmers to rethink their ideas, but saying "this is right because it's like in math" is selling the idea short, and not doing any justice to the strengths of functional programming.
- T_S_ 15y agoIt's not just a matter of syntax. It's what some people call the difference between expression (which are mathematical) and statements (which are harder to manage mathematically). Check out Hughes' well known paper or some discussions about it. <http://weblog.raganwald.com/2007/03/why-why-functional-programming-matters.html> http://weblog.raganwald.com/2007/03/why-why-functional-progr...; I simply point out this feature because most people focus on language features and this is "programmer feature" that you might not think of if it wasn't pointed it out.
- silentbicycle 15y agoOr, put another way, statement-based languages vs. expression-based languages. Strictly speaking, they can be equivalent, but each pushes code in different directions by default. (And for the whole "= means mutate-variable" thing, I think "<-" is a good operator.)
- mahyarm 15y agoSqueak smalltalk has the <- character. It's actually the '_' character but displays as a one character width left arrow. You can also use :=