Skip to content

[Request/Question] Allow control over if/how the $env var is exposed  #710

Closed

Description

@prateek

I'm considering using expr at DAYJOB and would like to not expose the $env var using that name. We're planning on using expr as a DSL and the domain has vars which conflict with $env and/or look similar enough that I want to stray from any confusion.

I skimmed thru the code and it doesn't look like I can hide it from the expr programs via configuration today. Please call out if I just missed that.

Questions I have for you:

  • Does this var need to be exposed to end users? I can understand the convenience of it, but do you see it as a must have or a nice to have?
  • Would you be amenable to allowing it to be exposed under a different name? If not, would you be amenable to allowing it to not be exposed (something like the DisableBuiltin() directive)?

I'm happy to do the work to support my request but I wanted to ask before I went and put up a PR that doesn't align with your direction for expr.

Activity

  1. mdmcconnell commented on Sep 11, 2024

    @mdmcconnell
    Contributor

    It looks like a handful of users have found $env to be a useful convenience, so perhaps it is preferable to add a directive to disable it, versus remove or rename.

  2. antonmedv commented on Sep 11, 2024

    @antonmedv
    Member

    Does this var need to be exposed to end users? I can understand the convenience of it, but do you see it as a must have or a nice to have?

    In some cases, vars in env can contain dashes or spaces some-field or some var.

    So using $env is convinient: $env["smoe-field"] == 42

    Would you be amenable to allowing it to be exposed under a different name? If not, would you be amenable to allowing it to not be exposed (something like the DisableBuiltin() directive)?

    Sure. I think we can make $env configurable. Let's make DisableBuiltin("$env") work.

  3. added a commit that references this issue on Mar 27, 2026
    aa10d51
  4. added a commit that references this issue on Nov 21, 2026
    60ff29b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions