PreviousUp

10.4.7  compound identifiers

Like C++ classes, each Mythryl package has its own internal namespace in which its elements live. Each element may be a type, value, constructor, subpackage, and thus may have as name an operator, lower-case, mixed-case or upper-case identifier.

Much as in C++, elements of other packages may be referenced using compound identifiers of the form package::element:

    posix::File_Descriptor      # Reference a type        in package "posix".
    posix::(|)                  # Reference an operator   in package "posix".
    posix::fd_to_int            # Reference a function    in package "posix".
    posix::stdin                # Reference a value       in package "posix".
    posix::MAY_READ             # Reference a constructor in package "posix".
    posix::posix_file           # Reference a subpackage  in package "posix".
    posix::posix_file::mkdir    # Reference a function in a subpackage of package "posix".

As shown, nonalphabetic identifiers are enclosed in parentheses when referenced as part of such a compound identifier. This is purely to solve the syntactic problem that (for example) ::| is a perfectly legal non-alphabetic identifier, so it would otherwise be unclear whether posix::| was a compound identifier or just two identifiers in sequence, one alphabetic, one not.


Comments and suggestions to: bugs@mythryl.org

PreviousUp