# Command: ::

NEST HelpDesk | Command Index | NEST Quick Reference

Name:

    :: - execute a symbol from a nested namespace

Synopsis:

    A/name ::	 -> executes A::name (symbol "name" from namespace "A")
      A/B/name ::	 -> executes A::B::name
      A/B/C/name ::   -> executes A::B::C::name
      A/B/C/D/name :: -> executes A::B::C::D::name

Examples:

      SLI ] /A namespace
      SLI ]   /B namespace
      SLI ]	 /myvar 23 def
      SLI ]   end
      SLI ] end
      SLI ] A/B/myvar :: =
      -> 23

      SLI ] /X namespace
      SLI ]   /var_in_x 23.5 def
      SLI ]   /Y namespace
      SLI ]	 /func {var_in_x =} def
      SLI ]   end
      SLI ] end
      SLI ] X/Y/func ::
      -> 23.5

Description:

      The :: operator looks up and executes a symbol from a nested namespace.

      The normal rules for symbol execution apply, i.e.
     	- if the symbol is a variable, its value is returned.
     	- if the symbol is a routine, it is executed.

      The symbol is executed in the full nested context, i.e.
      if you call a routine "A/B/C/routine ::", the routine can
      access symbols from namespaces "A", "B" and "C" as if
      the namespaces had been opened in this order.
      "A/B/.../name ::" is equivalent to:
      /A namespace
      /B namespace
      ...
      name
      ...
      end
      end

      The lookup is safe in the sense that, if the symbol cannot be found,
      the scope will stay unchanged, so that the user can safely recover
      from the error. If however the called symbol is a routine and this
      routine raises an error, the user will find the interpreter at the
      scope of the nested routine.

Parameters:

      A,B,C,D: nested namespaces
      name: name of the symbol to look up and execute

Diagnostics:

      If the symbol cannot be found at the specified nested position,
      /UnknownMember is raised. In this case, the operand and dictionary
      stacks will stay unchanged, so that the user can safely recover from
      the error.

      If the called symbol is a routine and this routine raises an error,
      the scope will be that of the nested routine.

Remarks:

      Currently implemented up to a depth of four nested namespaces.

Author:

    Ruediger Kupper

FirstVersion:

    17-jun-2008

SeeAlso:

- namespace
- call

Source:

    /opt/conda/conda-bld/nest_1524088722951/work/nest-2.14.0/lib/sli/library.sli

NEST HelpDesk | Command Index | NEST Quick Reference

© 2004 The NEST Initiative