Skip to content

A Note on Namespace Names

mahills edited this page May 28, 2013 · 1 revision

In PHP, namespaces are given using syntax similar to directory names, with each part of the namespace path separated by a \ character. In the AST, we instead separate these names using a double colon. So, a name like

utils\text\print_text

would be given in the AST as

name("utils::text::print_text")

This makes matching (and, I would argue, reading) the names easier, since \ is an escape character in Rascal. Note that there is no confusion with static class members, accessed in PHP using ::, since those are given specifically with the constructors staticCall and staticPropertyFetch (the :: will not appear in the names of the properties or methods).

More on PHP namespaces, with some examples, can be found here.

Clone this wiki locally