On Tue, 2016-04-12 at 11:40, Didier Verna <did...@didierverna.net> wrote:
>   What's the rationale behind making "function" const? Is there a
>   performance reason?

Yes, globals need to be const to be fast.

> you can't do
>
> function foo() 0 end
> foo = 10
>
> but you can still change the function's definition (so it's methods;
> even if the generic remains the same object I guess), and besides, you
> can however do this:
>
> bar = () -> 0
> bar = 10
>
> Oh, maybe the fact that foo is a generic function but bar an anonymous
> one matters?

yes, this just binds a function to a variable.  This also works:

julia> foo() = 1
foo (generic function with 1 method)

julia> bar = foo
foo (generic function with 1 method)

julia> bar = 2
2

Reply via email to