std icon indicating copy to clipboard operation
std copied to clipboard

typechecking individual cell blocks

Open nrdxp opened this issue 3 years ago • 4 comments

Currently cell-blocks just accept an attribute-set of anything, explained in the following comment: https://github.com/divnix/std/blob/3335a48d421604093e5e48527e870973d9735511/src/validators.nix#L112-L118

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

nrdxp avatar Sep 12 '22 16:09 nrdxp

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.

blaggacao avatar Sep 12 '22 20:09 blaggacao

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.

nrdxp avatar Sep 12 '22 22:09 nrdxp

I have a good reference use case stacked away here (for study): https://github.com/divnix/POP/commit/bcef37270dcd8becfcd67ad20bf1b2555f008cf6

blaggacao avatar Sep 12 '22 22:09 blaggacao

First step underway: https://github.com/paisano-nix/core/pull/3

blaggacao avatar Feb 18 '23 02:02 blaggacao