• Re: strange behaviour with package and namespace

    From Rich@21:1/5 to eukelade@gmail.com on Thu Feb 8 19:14:50 2024
    pd <eukelade@gmail.com> wrote:
    I also thought ::X::y and X::y to be analogous, like an alias...

    No, those two are not analogous.

    but maybe X::y is relative to current namespace

    It is. So X::y will only resolve to ::X::y provided you do not have a
    sub X namespace in your current namespace.

    rather than relative to root namespace and thus ::X::y is not the
    same of X::y

    No, those two are not identical. X::y just ends up finding ::X::y
    because of the namespace name lookup rules, and then only when you
    don't have an X namespace below where you are.

    If you have this

    ::X

    Then in ::X just Y will look for ::Y as part of the name resolution.

    But if you have this:

    ::X::Y

    Then when in ::X, just Y will find ::X::Y and not ::Y (even if you also
    have a ::Y).

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Harald Oehlmann@21:1/5 to All on Fri Feb 9 08:43:21 2024
    Am 08.02.2024 um 20:14 schrieb Rich:
    pd <eukelade@gmail.com> wrote:
    I also thought ::X::y and X::y to be analogous, like an alias...

    No, those two are not analogous.

    but maybe X::y is relative to current namespace

    It is. So X::y will only resolve to ::X::y provided you do not have a
    sub X namespace in your current namespace.

    rather than relative to root namespace and thus ::X::y is not the
    same of X::y

    No, those two are not identical. X::y just ends up finding ::X::y
    because of the namespace name lookup rules, and then only when you
    don't have an X namespace below where you are.

    If you have this

    ::X

    Then in ::X just Y will look for ::Y as part of the name resolution.

    But if you have this:

    ::X::Y

    Then when in ::X, just Y will find ::X::Y and not ::Y (even if you also
    have a ::Y).


    May I also underline, that the name resolution changed in 9.0.
    9.0 does not try any more to resolve in the global namespace without
    prefixed "::". So, in 9.0 it will "X::y" will only work from the global namespace, "::X::y" will work from any namespace.

    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)