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

fix: proper type checking on targets #3

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

Conversation

nrdxp
Copy link
Contributor

@nrdxp nrdxp commented Feb 10, 2023

Blocktypes can define their own custom yants types and they will be checked properly, giving us some actual type safety.

Leaving in draft until I can implement some times in Standard upstream and test this properly. Also need to double check if this is breaks laziness.

Blocktypes can define their own custom yants types and they will be
checked properly, giving us some actual type safety.
blaggacao

This comment was marked as resolved.

Q: should we use uncheckd imported for the registry (i.e. the
extractor)?
  - would that have any noticeable impact on registry eval?
  - if it's a drv it's already not lazy as soon as .meta is queried
  - when the type is `drv`, the check in yants is
    `drv = typedef "derivation" (x: isAttrs x && x ? "type" && x.type == "derivation");`
    if that's not lazy, then we incur in extra costs for all items that
    otherwise wouldn't have needed to eval a drv
  - practically speaking, the time real sensitive eval is `init`
  - but `init` already incurs in an evaluation for `meta` (display)
  - type checking _could_ have a negative impact when lib.lazyDerivation
    is used, as this only shields `.meta` & `.passthru`, but not `.type`?
    - A: we're lucky, `.type` is lazy in lazyDerivation, see:
      https://github.com/NixOS/nixpkgs/blob/29f41f2a5d31f04e58334376dc08ced7212df197/lib/derivations.nix#L90
  - `.type` or `isAttrs` breaking laziness needs to be validated
# extract instatiates actions and extracts metadata for the __std registry
extracted = l.optionalAttrs (cellBlock.cli or true) (l.mapAttrs (_extract cellBlock) imported);
extracted = l.optionalAttrs (cellBlock.cli or true) (l.mapAttrs (_extract cellBlock) imported');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The big question: type-checked imported' here (for the extractor → registry) or unchecked imported?

I left a couple of considerations in the commit message...

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.

2 participants