From f193f543ba57ee5f6adbc27f0fcb8025e9234cb3 Mon Sep 17 00:00:00 2001 From: Valentin Gagarin Date: Thu, 15 Jun 2023 14:39:46 +0200 Subject: [PATCH] add example of best effort interop --- rfcs/0137-nix-language-version.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/rfcs/0137-nix-language-version.md b/rfcs/0137-nix-language-version.md index ffc286a..70cd0c7 100644 --- a/rfcs/0137-nix-language-version.md +++ b/rfcs/0137-nix-language-version.md @@ -564,6 +564,30 @@ $ nix-instantiate --eval bnix error: unsupported value type `complex` at built-in operator `+` ``` +In the following example, version 7 *removed* the `null` primitive, such that it can no longer be used. + +```nix +# a.nix +null +``` + +```nix +# b.nix +version 7; +import ./a.nix +``` + +```console +$ nix-instantiate --eval b.nix +error: unsupported value `null` +``` + +This is consistent with best-effort interoperability: +Old code keeps working on its own, and new code has to be adapted because it was not there before the breaking change. + +While this requires additional effort to adopt the new language version, expression authors can always recourse to writing new code in older versions while using newer evaluators. +This in fact allows for creating compatibility wrappers as needed. + ## Deprecation warnings ```