hhvm / hsl-experimental

Experimental features for the Hack Standard Library
MIT License
23 stars 10 forks source link

HSL Env: Introduction #181

Closed azjezz closed 3 years ago

azjezz commented 3 years ago

👋

I wanted to bootstrap the work on HH\Lib\Env, so this is PR is more of a "meta PR" to keep the discussion going.

This API is borrowed as-is from PSL, and it was initially inspired by the std::env crate from Rust.

The component contains common functions that are needed for day-to-day operations especially when writing CLI applications, such as dealing with process environment variables, retrieving args, and retrieving the current directory/script.

I'm not sure if this is the API we want in Hack, but so far, it has served it's purpose really well in both PHP and Rust.

Note: this PR missing the Env\current_exec() implementation, as it's a bit messy in PHP ( see current_exec.php ), so I'm wondering if there's a better way to do that here.

fredemmott commented 3 years ago

Sorry, we're not able to review this until we are able to review request data as a whole: query strings, environment variables, POST data, headers, ... . We're not just looking for a good solution for environment variables or 'the environment', but want a consistent solution regardless of request type (http/CLI/thrift/xbox/...) and we also want to be sure we've found the right definition of 'the environment'.

Some implications there: