On Fri, 09 Mar 2012 16:50:22 -0500, Adam D. Ruppe <destructiona...@gmail.com> wrote:

On Friday, 9 March 2012 at 21:36:28 UTC, Steven Schveighoffer wrote:
I can't say I agree with this, as it pollutes the global namespace with several common terms that could be used for fields.

There's no such thing as a global namespace in D, and
field names wouldn't be affected even if there was one.

Of course there isn't. What I meant was the module level namespace. Any file you import by default goes into your current module namespace. In effect it's the global namespace *for your module*.

But if I have to spell that out every time, it's going to be a lot of typing. It's generally understood that the "global namespace" is the effective global namespace during your module. Yes, there are ways to rename imports, I find it poor design to *require* renaming imports.

int minutes(int i) {
        return i;
}

struct A {
        int minutes; // not a problem
         void foo() {
              minutes = .minutes(1); // works
        }
}

Again, I find this just as descriptive and not terrible to type:

struct A {
  Duration minutes;
  void foo() {
      minutes = dur!"minutes"(1);
  }
}

-Steve

Reply via email to