Why should std::env::var panic?

The original request in this thread was to make env::var(_os) not panic. Can we agree that no matter what the rules for valid environment variable names actually are, env::var(_os) should return NotPresent instead of panicking when its argument is an invalid name? I haven't seen anyone arguing against this idea here.


It seems like everyone here agrees? So is the next step to make a PR and ask the libs team to sign off on it?


I'm working on drawing up that PR, since I had already claimed the relevant issue.

Edit: Currently, I'm only dealing with var and var_os. It seems like there's the most consensus for those, and we haven't fully worked out what to do with the others yet. Please let me know if this is a problem.