(http://docs.julialang.org/en/release-0.3/manual/variables-and-scoping/)

On Mon, May 11, 2015 at 9:06 PM, Isaiah Norton <[email protected]>
wrote:

> Given Julia's scoping rules, a function can always access a variable from
> the enclosing module or global scope, and it will only be an error if the
> variable is undefined at runtime. As such, isdefined only looks at module
> and global scopes.
>
> The only way to check something like this is to look at the function
> lambda externally (see also Lint.jl, which may already implement such a
> check).
>
> On Mon, May 11, 2015 at 6:11 PM, Juha Heiskala <[email protected]>
> wrote:
>
>>  Hello,
>>
>> Am I missing something or doesn't isdefined detect local variables of a
>> function?
>>
>>
>> julia> foo()= begin bar=1; isdefined(current_module(), :bar); end
>> foo (generic function with 1 method)
>>
>> julia> foo()
>> false
>>
>> Best Regards,
>>
>> Juha
>>
>> julia version 0.3.5
>>
>> julia> versioninfo()
>> Julia Version 0.3.5
>> Commit a05f87b* (2015-01-08 22:33 UTC)
>> Platform Info:
>>   System: Linux (x86_64-linux-gnu)
>>   CPU: Intel(R) Core(TM) i7-3667U CPU @ 2.00GHz
>>   WORD_SIZE: 64
>>   BLAS: libopenblas (NO_LAPACK NO_LAPACKE DYNAMIC_ARCH NO_AFFINITY)
>>   LAPACK: liblapack.so.3
>>   LIBM: libopenlibm
>>   LLVM: libLLVM-3.3
>>
>
>

Reply via email to