Speeding up DCD in big projects

WebFreak001 d.forum at webfreak.org
Tue Jul 21 19:24:19 UTC 2020


On Tuesday, 21 July 2020 at 19:03:05 UTC, H. S. Teoh wrote:
> On Tue, Jul 21, 2020 at 10:32:39AM -0700, H. S. Teoh via 
> Digitalmars-d wrote: [...]
>> Which also begs the question, *why* does it even throw in the 
>> first place.  The non-existence of a file is a 
>> normally-expected outcome of isFile/isDir, throwing in that 
>> case seems excessively heavy-handed. It's probably a case of 
>> bad API design.
> [...]
>
> There is the workaround of writing:
>
> 	if (f.exists && f.isDir) ...
>
> but it's ugly and involves an extra unnecessary syscall 
> roundtrip.
>
> Basically, this kind of API design is just hideous. I propose 
> we remove the throw from isDir/isFile.
>
>
> T

don't do this, this introduces a race condition (and is the 
reason why this was a function using try-catch in the first place)


More information about the Digitalmars-d mailing list