digitalmars.D - Publicly exposing an exception a module throws
- Shriramana Sharma (20/20) Oct 17 2015 If a module's function throws an exception, shouldn't that module public...
If a module's function throws an exception, shouldn't that module publicly
import that exception? Please observe:
$ cat errnoexception.d
import std.stdio;
//import std.exception;
void main()
{
File file;
try file = File("/non-existent-file");
catch (ErrnoException e) {}
}
$ dmd errnoexception.d
errnoexception.d(8): Error: undefined identifier 'ErrnoException'
Uncommenting the import of std.exception solves the problem, but I believe
it would make sense to have the exception *publicly* imported into std.stdio
to avoid having the user to manually import it. Agreed?
(Currently the exception is just thrown in stdio.d by errnoEnforce in l 385
which is imported at l 383.)
--
Oct 17 2015








Shriramana Sharma <samjnaa_dont_spam_me gmail.com>