S
indicates the current scope.
Some terminologies(as well as interfaces provided in NameResolution.jl) :
LHS
: left-hide-sideRHS
: right-hide-sidepseudo scope
: a scope but does not introduce free variables in its parent scope. I don't know how to call it actually,pseudo scope
is a tentative name.LOCAL
: to mark a symbol as local, instead of resolving it automaticallyGLOBAL
: to mark a symbol as global, instead of resolving it automatically
for i = I, j in J
body
end
i
is LHS in in S/for1
, I
is RHS in S
.
j
is LHS in S/for1/for2
, J
is RHS in S/for1
.
body
is RHS in S/for1/for2
.
$f = a
If $f
is a function calling expression, it's treated as function $f; a end
. See [Function Definition](#Function Definition).
Otherwise, all symbols(except heads of expressions) of $f
are LHS in S
, a
is RHS in S
.
function f(x::A{T}=default_value) where T
body
end
f
is LHS inS
(however the function name should be marked for further analysis, e.g., self recursions).
There's a pseudo scope S/mk-type-params
,
T
inwhere T
is LHS inS/mk-type-params
.
The requirement of a symbol in argument type annotations is from the scope S/mk-type-params
.
Say,
T
inf(x::A{T}=value)
is RHS inS/mk-type-params
, andA
is RHS inS/mk-type-params
(though we knowA
is fromS
, pseudo scope doesn't result in free variables).
The function execution has the scope S/mk-type-params/inner
and,
x
is LHS inS/mk-type-params/inner
,default_value
is RHS inS/mk-type-params/inner
,body
is RHS inS/mk-type-params/inner
Except for
Expr(:function, ::Symbol, Expr(:block, _...))
is a declaration
let a = b
c
end
S/let
is a pseudo scope.
b
is RHS inS
a
is LHS inS/let
c
is RHS inS/let