On Fri, Feb 13, 2009 at 06:27:07PM +0100, TSa wrote:
> Does that imply that packages behave like C++ namespaces? That is
> a package can be inserted into several times:
>
>    package A
>    {
>        class Foo {...}
>    }
>    # later elsewhere
>    package A
>    {
>        class Bar {...}
>    }
>
> I would think that this is just different syntax to the proposed
> form
>
>    class A::Foo {...}
>    class A::Bar {...}

No, they're not considered pragmatically equivalent.  By default an
explicit definition is assumed to be the only definition, and you'll
get a warning on a second explicit definition.  With the A::Foo form,
we can infer that there is an A package that may or may not have been
explicitly defined yet, but it produces no warning if an explicit
definition is subsequently seen.  (This is described in my recent
update to S10 a day or so ago.)

Larry

Reply via email to