On 03/25/2010 05:26 PM, Nick Sabalausky wrote:
"Walter Bright"<[email protected]> wrote in message
news:[email protected]...
Ellery Newcomer wrote:
I guess what I'm trying to say is it doesn't make sense that I can
implicitly import FooA, an external symbol, but not bar(FooA), an
external symbol defined on an external symbol which cannot be implicitly
converted to a local symbol.
And I believe it makes perfect sense! Everywhere else in the language,
when you define a local name it *overrides* names in other scopes, it
doesn't overload them.
Well, the result of that is that I'm forced to make my "genEnum" library
utility generate "enum{name of enum}ToString({name of enum} e)" instead of
"enumToString({name of enum} e)" or else users won't be able to use it
without a bunch of odd alias contortions that I'm not sure I can wave away
by including them in the original mixin. (I would have just called it
"toString", but at the time, that had been giving me some strange troubles
so I changed it to "enumToString" instead. In retrospect, it was probably
giving me trouble because of this very same issue.)
Suggestion: forget about enums. Implement something based on structs or
classes a la Java, which gives you
e.toString
instead of
toString(e)
From this conversation, I'm getting the idea that enums are more an
antifeature than anything. And you're using mixins already anyways.