On 9/8/11 11:11 AM, Simen Kjaeraas wrote:
On Thu, 08 Sep 2011 15:17:51 +0200, Steven Schveighoffer
<[email protected]> wrote:

I wonder if there's a way to give the option of using a template
parameter or using a positional parameter without having two different
symbol names. hm...

openFile!(string modedefault = "r")(string filename, string mode =
modedefault) if (isValidOpenMode(modedefault))
{
if(!isValidOpenMode(mode))
throw new Exception("invalid file open mode: " ~ mode);
...
}

Would that work?

Neat! And yes, it certainly does work. I'm still unsure when someone
will actually need to specify that at runtime, but maybe for scripting
languages?

My opinion: we're spending way too much energy on this. File I/O poses much more difficult problems than choosing representation of open flags.

Andrei

Reply via email to