On 2012-04-04 17:53:24 +0000, "Steven Schveighoffer" <[email protected]> said:

But yes, I think the issue really becomes, we need to look at context when deciding the semantic meaning of a symbol. I don't think this violates the context-free grammar, because wouldn't this only come into play at the semantic level? Not a compiler writer/hacker, so I don't know.

You'd need a whole lot of context.

Let's say I write:

        .a.b.c.d = .e.f.g.h;

Can you tell me which letters are the name of a package/module, and which are the name of something else? It could be this:

        module a.b;
        struct c { static int d; }

        module e.f.g;
        int h;

or it could be this:

        module a;
        struct b { struct c { struct d { static void opAssign(int); } } }

        module e;
        struct f { enum g { h = 1 } }

or a multitude of other variants. If you can't know by looking at the assignment above, how will the parser know?

Fully qualified names really need to refer to a single thing.


Say you wanted to create a package.d file directly for the whole package std, what should be done for those?

No, let's not do that.  Ever. :)

Phobos is just an example. People will want to use "package.d" files for their own libraries too, and will complain if it doesn't work.


--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to