Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin
Znav
nextPHP Mapping for Built-In Types
prevPHP Mapping for Identifiers

By default, identifiers defined within a Slice module are mapped to a flattened symbol that uses underscores as module separators. Consider the following Slice definition:

Wiki Markup
{zcode:slice}
module M {
    module N {
        enum Color { red, green, blue };
    };
};
{zcode}

The Slice identifier Color maps to M_N_Color by default because PHP releases prior to version 5.3 lacked language support for namespaces. If you prefer to use namespaces instead, you can enable an alternate mapping in which Slice modules map to PHP namespaces with the same name as the Slice module. This mapping preserves the nesting of the Slice definitions. Using the namespace mapping, the Slice identifier Color maps to \M\N\Color.

Be aware that using underscores in your Slice definitions can lead to name collisions in the flattened mapping. Consider the following example:

Wiki Markup
{zcode:slice}
module M {
    module N {
        enum Color { red, green, blue };
    };
};

module M_N {
    interface Color { };
};
{zcode}

Although these definitions are syntactically correct, they both map to the flattened PHP symbol M_N_Color.

Ztop
See Also
Zret
Znav
nextPHP Mapping for Built-In Types
prevPHP Mapping for Identifiers