If I make the function a const, I can overload it: const f = @fn x -> x f(x) = -x
which you sometimes want and sometimes could. So I'm hoping that soon anonymous functions will behave just like regular ones except to disallow adding methods to them. On Wednesday, 8 January 2014 15:10:43 UTC+1, Mike Innes wrote: > > Pierre-Yves: My bad; I've updated the gist so that this syntax works. > > Toivo: Aside from performance the functions generated by @fn should behave > exactly the same as regular anonymous ones. Although they are technically > named (something like ##521), the name is untypeable so they can't be > altered or overloaded (at least not by accident). Redefining a function > with e.g. f = @fn x -> x will simply replace it as usual, and f(x) = xwill > throw an error. > > I didn't know about PatternDispatch.jl, it looks really cool. > Thanks! I'm actually working on an improved version, but it's taking longer than I had hoped...
