Is it possible to "overload" based on visibility?

60rntogo 60rntogo at
Fri Sep 25 07:43:51 UTC 2020

On Wednesday, 23 September 2020 at 19:27:13 UTC, Steven 
Schveighoffer wrote:
> This is a bug in the language.

Is this a known bug? If not, it should be reported.

I came up with an answer to my original question that sort of 

module foo;

struct Foo
   private int x;

int x(Foo f)
   return f.x;

The downside is that if I don't want to import all of foo at 
once, then I have to import both Foo and x, but then I can read x 
from outside the module and modify it form inside as I wanted. 
Are there any drawbacks of this approach that I'm not seeing?

More information about the Digitalmars-d-learn mailing list