On Sat, 24 Sep 2011 16:26:34 -0400, mta`chrono <chr...@mta-international.net> wrote:

Quote: Steven Schveighoffer
An example I gave in the bug report just now is File.  Imagine you have
a File struct, and want to have an open method:

struct File
{
   static File open(string fname);
}

However, now this is valid code:

File f; // <-------- here's the problem!
f.open(fname);  // does not do what you think it does...


Yes, but why is he able to get an instance of File? The Designer of
"File" should have rather used a class and disallow to create any
instance of it. (@disable this)

I think this post predates @disable this (not sure), but in any case, that is not the issue:

File f = File.open("blah.txt");
f.open("blah2.txt");

-Steve

Reply via email to