The new std.process is ready for review

Lars T. Kyllingstad public at kyllingen.net
Mon Feb 25 12:09:14 PST 2013


On Monday, 25 February 2013 at 19:38:59 UTC, Vladimir Panteleev 
wrote:
> On Monday, 25 February 2013 at 19:28:33 UTC, Lars T. 
> Kyllingstad wrote:
>> This means that you will almost *always* have to check whether 
>> a variable exists before using it, thus rendering opIndex() 
>> pretty much useless for most cases.
>
> Check... and do what? Print a nicer error message?

That would depend on the application.


>> Furthermore, I really don't think it is too much to expect 
>> that a user of a systems language such as D checks the return 
>> values of functions that may return a 'null' value.
>
> Expecting any sorts of things from the library user is not the 
> way to go. It is the same reason why returning integer error 
> codes has gone by way of history in favor of exception 
> handling: checking all return values is cumbersome, it requires 
> writing more code, many programmers don't do it, and the result 
> is bad programs. The simplest code should also be correct, this 
> is one of D's principles.

Exceptions are designed to handle exceptional cases.  A missing 
environment variable isn't exceptional, it is commonplace.

Lars


More information about the Digitalmars-d mailing list