On 11 Jan 2010, at 19:19, mike clemow wrote:
All I was saying originally, however, was that we should overload @=> to be able to reassign functions themselves to other references.
fun void foo(int i) { <<< i >>>; }
foo @=> fun void foo2;
1 => foo2; // prints 1
This is possible in SML. This can cause some unexpected code:
fun twice x = 2*x;
fun increment x = x + 1;
...
val twice = increment;
and now the function twice instead increments.
The code in Haskell is:
twice x = 2*x;
increment x = x + 1;
twice = increment;
and it produces this error in Hugs:
ERROR "Twice.hs":23 - "twice" multiply defined
even producing a joke. :-)
Haskell prohibits it because the renaming of functions seem dangerous
- it is not needed in programming, really.
Instead has a module system. In Haskell, it has to be in one file. One
writes:
module Twice (