just icon indicating copy to clipboard operation
just copied to clipboard

Allow const expressions in settings

Open casey opened this issue 1 year ago • 0 comments

Currently, arbitrary expressions are not allowed in settings. This is because the value of expressions can, in the general case, depend on settings. An example is the env_var() function, which depends on environment variables, which may be loaded by .env related settings, or shell() and backticks, which depend on the shell.

This has come up a bunch of times, for example in #2307, where it would be useful to use a just variable to determine which env var is loaded.

I think the solution is to distinguish between "const" expressions, which cannot depend on settings or other operations, and can be evaluated statically, and non-"const" expressions, which can, and allow "const" expressions in settings.

Variables could be explicitly annotated as const const foo := …, or it could just be implicit.

casey avatar Aug 10 '24 16:08 casey