From 05c6db6500de0551882a2d6cc612c9afb6ca674c Mon Sep 17 00:00:00 2001 From: metagn Date: Sun, 8 Jan 2023 08:49:49 +0300 Subject: underscores for routine parameters (#21192) * underscores for routine parameters fixes #13443, fixes #13804, refs #21121 * add changelog + more tests * support generics and ensure inferred lambdas work --- changelogs/changelog_2_0_0.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'changelogs') diff --git a/changelogs/changelog_2_0_0.md b/changelogs/changelog_2_0_0.md index 9ff493b54..c8427cc2a 100644 --- a/changelogs/changelog_2_0_0.md +++ b/changelogs/changelog_2_0_0.md @@ -135,6 +135,21 @@ - The experimental strictFuncs feature now disallows a store to the heap via a `ref` or `ptr` indirection. +- Underscores (`_`) as routine parameters are now ignored and cannot be used in the routine body. + The following code now does not compile: + + ```nim + proc foo(_: int): int = _ + 1 + echo foo(1) + ``` + + Instead, the following code now compiles: + + ```nim + proc foo(_, _: int): int = 123 + echo foo(1, 2) + ``` + - - Added the `--legacy:verboseTypeMismatch` switch to get legacy type mismatch error messages. ## Standard library additions and changes -- cgit 1.4.1-2-gfad0