On Mon, Feb 17, 2014 at 1:02 PM, Jameson Nash <[email protected]> wrote:
> Fil, your second form of writing the function is functionally
> identical to the first -- it is only a difference in syntax and makes
> absolutely no difference to the compiler.
There are differences to the compiler:
julia> dump(:(x->x))
Expr
head: Symbol ->
args: Array(Any,(2,))
1: Symbol x
2: Expr
head: Symbol block
args: Array(Any,(2,))
1: Expr
head: Symbol line
args: Array(Any,(2,))
typ: Any
2: Symbol x
typ: Any
typ: Any
julia> dump(:(function (x); x; end))
Expr
head: Symbol function
args: Array(Any,(2,))
1: Expr
head: Symbol tuple
args: Array(Any,(1,))
1: Symbol x
typ: Any
2: Expr
head: Symbol block
args: Array(Any,(2,))
1: Expr
head: Symbol line
args: Array(Any,(2,))
typ: Any
2: Symbol x
typ: Any
typ: Any
These differences (-> / function) could make a real difference to type
inference, and seem to from the local/const examples.