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

libnixf: incremental eval & type inference system #482

Open
inclyc opened this issue Apr 29, 2024 · 0 comments
Open

libnixf: incremental eval & type inference system #482

inclyc opened this issue Apr 29, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@inclyc
Copy link
Member

inclyc commented Apr 29, 2024

Design Review

Motivation

Evaluation is indeed indispensable in the Nix language.

For example, #480 mentioned if we can provide some auto-completion for custom args:

{ pkgs, root, ... }: # <- provide autocompletions for these args using the expression above

Case 2: #471 mentioned if we can provide completions for "selection"

{pkgs}:
{
  asdf = pkgs.asdf;
}

Previously, nixd performed comprehensive evaluations, gathering insights into the values linked with each Abstract Syntax Tree (AST) node. This method facilitated the provision of language features like completion and diagnostics through real-time evaluations. However, the performance repercussions are significant. Each system-wide configuration evaluation takes several seconds to finalize, and users are obliged to specify the project's evaluation method, which is rather inconvenient.

However, the performance implications of full evaluation can severely hinder on-the-fly editing. So the challenge is:

  • How to incrementally evaluate the code? (In less than ms?)
  • How to discover the target automatically?

Ideas

"Incremental" processes invariably entail immutability. Hence, I've been pondering the prospect of introducing immutability to certain segments of the evaluation process. For instance, we could maintain the immutability of the evaluation results for all Nixpkgs. Perhaps the optimal solution lies in devising an evaluation system focused on individual files, while deferring resolution on external immutable values. But the question remains: how can we achieve this?

Value resolution regarding nix language

So what is the resolution then...

@inclyc inclyc added the enhancement New feature or request label Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant