You are quite welcome. Glad to clarify.

On Mon, Dec 8, 2014 at 4:18 PM, <[email protected]> wrote:

> Ok I got it. Sorry, I was a bit confused.
> Thank you :)
>
>
> On Monday, December 8, 2014 1:28:47 PM UTC+1, Stefan Karpinski wrote:
>
>> On Mon, Dec 8, 2014 at 3:24 AM, <[email protected]> wrote:
>>
>>>
>>>
>>> On Monday, December 8, 2014 6:15:37 PM UTC+10, [email protected] wrote:
>>>>
>>>> Thank you for the explanation Stefan.
>>>> But isn't it possible to just consider the scopes declared inside of a
>>>> function + the global scope while looking for a variable definition? I find
>>>> the fact that the variable can come from the scope in which the function is
>>>> called strange.
>>>>
>>>
>>> It can come from the scope in which the function is defined, not the
>>> scope in which it is called, see http://docs.julialang.org/
>>> en/latest/manual/variables-and-scoping/#scope-of-variables
>>>
>>> Cheers
>>> Lex
>>>
>>
>> Yes, variables can only come from the scope where the function is
>> defined, not where it is called – that is lexical scoping. Allowing
>> variables to come from the calling scope is dynamic scoping, which has
>> generally fallen out of favor in modern programming languages because it
>> makes it impossible to reason locally about the meaning of code.
>>
>

Reply via email to