Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC 0120] Discourage nested with expressions #120

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

fogti
Copy link
Contributor

@fogti fogti commented Jan 12, 2022

Rendered

This has come up while trying to implement alternative interpreters/evaluators for the Nix language, and similar tools which need to perform static analysis on Nix expressions.

This idea is a compromise. The original idea was to forbid with expressions completely, which proved to be undesirable and impratical. A related idea was the introduction of a with-only expression, but it (1) wouldn't completely solve the problem and (2) introduce another keyword with no apparent immediate benefit.

This issue was discussed quite a few times on various channels, and this is an attempt to move closer to a solution.

cc @sternenseemann

@fogti fogti changed the title [RFC 0120] Discourage nested 'with' expressions [RFC 0120] Discourage nested with expressions Jan 12, 2022
@L-as
Copy link
Member

L-as commented Jan 12, 2022

Related: #110

@gytis-ivaskevicius
Copy link

For the record let me explain what @L-as means by noting inherit-as-list RFC. Assuming this RFC gets implemented - there is no need for with-only expressions due to syntaxes as such:

# Basic usecase:
meta = {
  inherit homepage; # inherit in attribute set
  license = with licenses; [ inherit (lib.licenses) mit  ]; # inherit in list
}

# Not so obvious syntax
let inherit (lib) mapAttrs filterAttrs; in {
  a = mapAttrs (a: b: xyz) abc;
  b = filterAttrs (it: xyz) abc;
}

rfcs/0120-no-nested-with.md Outdated Show resolved Hide resolved
@fogti fogti marked this pull request as ready for review April 11, 2022 09:07
@lheckemann lheckemann added status: open for nominations Open for shepherding team nominations and removed status: draft labels Apr 20, 2022
@lheckemann
Copy link
Member

This RFC is now again open for nominations :)

@kevincox
Copy link
Contributor

kevincox commented May 4, 2022

This RFC has not gotten any nominations which appears to show lack of interest from the community. In order to drive this RFC forward I recommend trying to help find shepherds by reaching out to people you know and posting in discourse or Matrix.

If no shepherds can be found we will convert this RFC to draft to be on hold until we can find enough interested participants.

@tomberek
Copy link
Contributor

tomberek commented Jun 1, 2022

To re-iterate the previous comment, this RFC will require some shepherds in the next two weeks otherwise will be turned into a draft awaiting further interest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants