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

typechecking individual cell blocks #131

Open
nrdxp opened this issue Sep 12, 2022 · 4 comments
Open

typechecking individual cell blocks #131

nrdxp opened this issue Sep 12, 2022 · 4 comments

Comments

@nrdxp
Copy link
Contributor

nrdxp commented Sep 12, 2022

Currently cell-blocks just accept an attribute-set of anything, explained in the following comment:

std/src/validators.nix

Lines 112 to 118 in 3335a48

# unfortunately eval during check can cause infinite recursions
# if blockType == "runnables" || blockType == "installables"
# then attrs drv
# else if blockType == "functions"
# then attrs function
# else throw "unreachable";
attrs any;

We should explore ways that we can eliminate infinite recursion here. builtins.genericClosure perhaps?

@blaggacao
Copy link
Collaborator

blaggacao commented Sep 12, 2022

If we can make this work, this would be really nice to establish something more than just "gentlemen's agreement". I haven't had genericClosure on my screen as a potential mitigator...

Adding typeCheck to each Cell Block Type and start failing hard and early, would be awesome.

@nrdxp
Copy link
Contributor Author

nrdxp commented Sep 12, 2022

genericClosure is essentially the only way to do efficient (as in, doesn't eventually overflow) recursion in Nix, since it uses C++ primitives under the hood instead of an ever growing functional call stack. Not sure or not yet if it would also allow an escape hatch for us here, as it's usage is fairly complex and I'm not sure I fully understand it yet.

@blaggacao
Copy link
Collaborator

I have a good reference use case stacked away here (for study): divnix/POP@bcef372

@blaggacao
Copy link
Collaborator

First step underway: paisano-nix/core#3

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

No branches or pull requests

2 participants