On 2011-09-06 17:11, Andrei Alexandrescu wrote:
On 9/6/11 10:05 AM, Jacob Carlborg wrote:
On 2011-09-06 15:02, Steven Schveighoffer wrote:
Yeah, creating a new file is implied by a combination of modes.
The one that's confusing I think is that "a" is for append, but "+" kind
of tacks on appending to any other mode. It's not the most well-designed
spec for file opening. Add to that you have the "b" which is a noop on
most OSes.
There is the possibility that we could accept an alternative open mode
string, which we could design better. But we have to keep fopen's spec,
it's already used everywhere.
-Steve
Ok, I would prefer to use enums if they have sensible names. Something
like this:
File.open(Mode.read | Mode.write); // for both read and write
Honest, C's openmode strings have been around for so long, they hardly
confuse anyone anymore. I'd rather use "rw" and call it a day.
Andrei
I disagree.
--
/Jacob Carlborg