Each module contains a binding to itself. This is like an array that
contains a reference to itself or any other self-referential structure.



On Sat, Sep 6, 2014 at 4:16 PM, lgautier <[email protected]> wrote:

> Hi,
>
> When using Module(), I noticed the following:
>
> ```
> julia> md = Module(:md)
> md
>
> julia> md.md
> md
> ```
> ?
>
> ```
> julia> md.foo
> ERROR: foo not defined
> ```
>
> I expected the one above.
>
> Now it seems that the rabbit hole goes far...
> ```
> julia> md.md.md
> md
>
> julia> md.md.md.md
> md
> ```
>
> Trying to define a member of the module that has the same name as the
> module result in an error:
>
> ```
> julia> Base.eval(md, Expr(:const, Expr(:(=), :md, 123)))
> ERROR: invalid redefinition of constant md
> ```
>
> What am I missing ?
>
>
> Thanks,
>
> Laurent
>
>

Reply via email to