Possible for --arg to never apply, generating no warnings #775

Open
opened 2025-03-26 20:19:03 +00:00 by jade · 2 comments
Owner

nix eval --arg and --arg in general is cursed. It automatically calls any functions encountered that accept the given argument as a formal parameter, but not if it is accepted as args@{...}.

This is itself confusing, but what is MORE confusing is that Lix doesn't produce a diagnostic that the argument was not used.
We should produce a diagnostic once autocall is done doing its thing if it doesn't actually use the argument in the end.

`nix eval --arg` and `--arg` in general is cursed. It automatically calls any functions encountered that accept the given argument as a *formal parameter*, but *not* if it is accepted as `args@{...}`. This is itself confusing, but what is MORE confusing is that Lix doesn't produce a diagnostic that the argument was not used. We should produce a diagnostic once autocall is done doing its thing if it doesn't actually use the argument in the end.
Author
Owner

See this "fun" for other amusement that autocall generates. It's not a good feature. But we should stop shooting users in the foot with it unnecessarily. #263

See this "fun" for other amusement that autocall generates. It's not a good feature. But we should stop shooting users in the foot with it unnecessarily. https://git.lix.systems/lix-project/lix/issues/263
Member

Moving over my remark from #865

That doesn't sound like it is unreasonable to emit a diagnostic for in nearly every case, unless people have come to not just rely on this behavior by accident, but as intentional design (ie, they would get spammed with warnings from that).

There is however the question, do we want people to rely on this design? Can we come up with a timeline along which we can eventually turn that diagnostic into a hard error, even if it is going to sometimes painful as we only know it at the far end of eval that we have not consumed all the args. Obviously this may be a hard no due to how bad of a design choice originally was made.

Moving over my remark from #865 That doesn't sound like it is unreasonable to emit a diagnostic for in nearly every case, unless people have come to not just rely on this behavior by accident, but as intentional design (ie, they would get spammed with warnings from that). There is however the question, do we want people to rely on this design? Can we come up with a timeline along which we can eventually turn that diagnostic into a hard error, even if it is going to sometimes painful as we only know it at the far end of eval that we have not consumed all the args. Obviously this may be a hard no due to how bad of a design choice originally was made.
Sign in to join this conversation.
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: lix-project/lix#775
No description provided.