On Fri, Apr 29, 2016 at 8:33 AM, Tamas Papp <tkp...@gmail.com> wrote:
> Default value expressions for optional and keywords arguments are
> evaluated in the scope of the module that defines the function, which
> seems to be the Right Thing to do, but I could not find this specified
> in the manual. Did I miss it or is it just not spelled out? Asking
> because I would submit a correction if it is the intended behavior. Eg

This is just the default lexical scope. Note that it is *not* the
module that defines the function for closures. There's already a
section about the scope of default arguments so it is fine if you want
to submit something short that clarify this a little bit.

>
> --8<---------------cut here---------------start------------->8---
> module Foo
> bar=1
> foo(a=bar)=a
> end
>
> module Baz
> import Foo.foo
> bar=2
> foo2()=foo()
> end
>
> Baz.foo2()                        # will then eval to 1
> --8<---------------cut here---------------end--------------->8---
>
> Best,
>
> Tamas

Reply via email to