zimoun <zimon.toutoune@gmail.com> ezt írta (időpont: 2019. dec. 12., Csü 17:47):
Hi Gábor,

Thank you for summarizing the discussion on IRC that I missed.

Maybe I miss a point. Is the aim to conserve the "--ad-hoc" option
with a different effect? Or why do we want to conserve this option
It appears to me simpler to give another name, for example
"--inputs-of". And it is more meaningful.
Sorry for the confusion. Ad-hoc should be retained with the same effect, so that we do not break existing scripts.
Renamin the option would be ok. It even makes sense to me.

To be concrete, the different cases; (-) means current behavior and
(+) the new one:

- guix environment foo
+ guix environment --inputs-of foo

- guix environment --ad-hoc bar
+ guix environment bar

First, when "--ad-hoc" is used then it reports a warning: deprecated
option and falls in the current behavior.
When "--inputs-of" is used then it falls in the new behavior.
Therefore, no needs of the ugly "--ignore-deprecated-ad-hoc".
That could be done. The problem is caused by uses of guix environment that does not use any of these options. Those mean different things after the change.

In other words, with the same future guix version,

 # Alice
 $ guix environment foo --ad-hoc bar
 Warning: deprecated... explanations...
               instead use:
                guix environment bar --inputs-of foo

 # Bob
 $ guix environment bar --inputs-of foo

Second, the previous "guix environment foo" (dependencies of foo) is
inconsistent with the new "guix environment bar" (only the package
bar). Therefore, let introduce the GUIX_ENVIRONMENT_DEPRECATED
variable to distinguish both, as you said.

 # Alice
 $ guix environment foo
 Warning: previous behavior requires GUIX_ENVIRONMENT_DEPRECATED=1
               turn off the warning: GUIX_ENVIRONMENT_NOWARNING=1

And Alice has now a new shell with the package foo. If she wants the
dependencies, she has two options:

$ GUIX_ENVIRONMENT=1 guix environment foo
$ guix environment --inputs-of foo

 # Bob
 $ guix environment bar
 Warning: previous behavior requires GUIX_ENVIRONMENT

And if Bob is annoyed by the warnings each time, he globally turns off

Couple of months later -- after the period adoption -- we remove the
still keeping the warning with the "--ad-hoc" option. And then, after
we can remove the "--ad-hoc" option if required.

Maybe a miss a point. But the addition of the flag appears
"--too-long-to-type" to me ugly.
We could recommend simply to use something like:
GUIX_ENVIRONMENT_DEPRECATED=0 guix environment ...
Instead in existing scripts that are fixed to use the new syntax. This indeed looks like a better solution, and it is less of a maintenance burden. Good idea.

What do you think?

All the best,

Introduce the environment variable.
For fixed scripts recommend unsetting the environment variable.

That looks like a better plan. Thanks for your insights.

Best regards,