http://d.puremagic.com/issues/show_bug.cgi?id=8909
Summary: is{File,Dir,SymLink} mix return error code and exception Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: Phobos AssignedTo: nob...@puremagic.com ReportedBy: dimitri.saba...@gmail.com --- Comment #0 from Dimitri Sabadie <dimitri.saba...@gmail.com> 2012-10-29 07:46:15 PDT --- I think a call to .isFile / .isDir / .isSymLink shouln’t throw any exception. The problem here is that to use, for instance, isFile, we have to use it this way : try { "path/to/file".isFile; } catch (const Exception e) { /* treat the error here */ } Such a fonction is excepted — according to its name — to be used by checking it’s returned value : if (!"path/to/file".isFile) { /* treat the error here */ } The problem is that the current interface mix both those methods, so the above codes is just fucking weird for two reasons : 1. if "path/to/file" is not a file, the if statement won’t even be executed because of the thrown exception, so an if statement is not good here 2. we don’t catch the exception, so we can’t treat the error. An if we do, we don’t rely on the returned value. I propose to remove the exception throw. I’d really love to write this patch, I’m motivated to contribute to D and all projects around it. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------