The new std.process is ready for review

Vladimir Panteleev vladimir at thecybershadow.net
Mon Feb 25 12:21:53 PST 2013


On Monday, 25 February 2013 at 20:09:14 UTC, Lars T. Kyllingstad 
wrote:
> Exceptions are designed to handle exceptional cases.  A missing 
> environment variable isn't exceptional, it is commonplace.

I disagree. I don't know your uses cases, but as far as I can 
see, if the program expects the variable to be present in the 
environment, then it is no different from a missing file which 
the program expects to be present, or malformed user input.

> That would depend on the application.

Could you provide a specific example? It's difficult to discuss 
the merits of either approach without some use cases.

As I see, there are two major cases:

1) The program expects a variable to be set. An example of this 
is COMSPEC / SHELL. These variables ought to be set on any 
system, so the user is not expected to verify this himself. The 
variables not being set is an exceptional sitation.

2) A variable may or may not be set, such as the case of passing 
additional options via the environment (such as INCLUDE, or 
LD_PRELOAD). The program will take specific action if the 
variable is not set, such as pretending it is empty, or 
defaulting to some other setting like one in a configuration file.

It seems like your approach caters to the second situation 
exclusively. I've mentioned the problems of applying this 
approach to the first situation in my previous post.


More information about the Digitalmars-d mailing list