lix/doc/manual/rl-next/deprecated-features.md
piegames 81d5f0a7d9 libexpr: Deprecate overriding __sub and the like
It was never intended to be a feature to be used, and moreover it is
inconsistent: One cannot override `+`, and overriding `__lessThan` won't
affect the builtins which do comparisons.

Change-Id: Iaba54a05aa4c2eb37cdb3dc0d731fcee5a86deba
2024-11-28 18:15:52 +01:00

1.6 KiB

synopsis issues cls category credits
Deprecated language features
fj#437
861
1785
1736
1735
1744
2206
Breaking Changes
piegames
horrors

A system for deprecation (and then the planned removal) of undesired language features has been put into place. It is controlled via feature flags much like experimental features, except that the deprecations are enabled default, and can be disabled via the flags for backwards compatibility (opt-out with --extra-deprecated-features or the Nix configuration file).

  • url-literals: URL literals have long been obsolete and discouraged of use, and now they are officially deprecated. This means that all URLs must be properly put within quotes like all other strings.
  • rec-set-overrides: __overrides is an old arcane syntax which has not been in use for more than a decade. It is soft-deprecated with a warning only, with the plan to turn that into an error in a future release.
  • ancient-let: The old let syntax (let { body = …; … }) is soft-deprecated with a warning as well. Use the regular let … in instead.
  • shadow-internal-symbols: Arithmetic expressions like 5 - 3 internally expand to __sub 5 3, where __sub maps to a subtraction builtin. Shadowing such a symbols would affect the evaluation of such operations, but in a very inconsistent way, and is therefore deprecated now. Affected symbols are: __sub, __mul, __div, __lessThan, __findFile and __nixPath. Note that these symbols may still be used as variable names as long as they do not shadow internal operations, so e.g. let __sub = x: y: x + y; in __sub 3 5 remains valid code.