So I'm targetting my compiler to PHP and I'm having some problems with namespaces.
They look something like this in my language:
package Foo
{
package Bar
{
class X { }
}
class Y { }
}
Of course, PHP doesn't handle nested namespaces. What's the best way to translate this code so it still works in PHP?
I should note that all files are compiled into a single PHP file in the end. One caveat of this is that I'll have to go back to the global namespace after I've closed a package, and I haven't found any documentation about how to do that. It seems to me that in PHP, once you declare a namespace, it applies to the whole file.