1.7.0 #1960
yannham
announced in
Announcements
1.7.0
#1960
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Version 1.7 (2024-06-11)
Note: the previous 1.7 released pointed to the wrong revision and was deleted. Although the attached artifacts and the tarball would still include all the actual 1.7 features, the nickel and nls binary would identify as 1.6 when using
nickel --version
. This release is identical to the previous one but points to the right revision with the version numbers up to date.Nickel 1.7 ships with several extensions to pattern matching which was introduced in Nickel 1.5 but had a number of limitations. See below for further details. Releases on other platforms that GitHub (such as crates.io) are unaffected.
Additionally, the publication of Topiary to the crates registry makes it so that all versions of Nickel from 1.7 and onward, however they are built, ship with
nickel format
and the language server formatting command working out of the box without needing a separate installation of Topiary (which was previously required when installing from crates.io usingcargo install nickel-lang-cli
orcargo install nickel-lang-lsp
).Breaking changes
Although primitive operators are internal and aren't officially part of any stability guarantee, some libraries sometimes need to resort to using them, when there's no equivalent in the stdlib. Nickel 1.7 had a big primop refactoring, amounting mostly to renaming. If you're using primops, please look at the corresponding pull request
The behavior of destructuring has been changed to match exactly the behavior of pattern matching. While there should be no difference on well-behaving programs, this change makes destructuring stricter and can lead to some programs that were running fine before 1.7 to now fail with
unmatched pattern
. The typical example is when destructuring a record with a field that is not present:let {x,y, ..} = import "lib.ncl" in
. Ifx
is absent from thelib.ncl
but is never used anywhere, this used to work fine before 1.7 (the error would only trigger upon usage ofx
) but will now fail eagerly.If you need to fix a large codebase with long import destructuring chains and you don't know which fields are the offending ones, one possible technique is to open the importing file in an editor and use the
goto definition
command of the NLS on each field of a faulty pattern. If it works, the field is present, but if it doesn't, the field might be faulty. You can also apply a record contract mimicking the structure of the pattern to theimport "..."
expression to get better error reporting.Core language
1
,null
,"a"
, etc.), arraypatterns (
[fst, snd, ..tail]
), pattern guards ('Foo x if std.is_number x
), wildcard patterns (_
placeholder) and or-patterns (('Foo x) or ('Bar x) or ('Baz x)
): (see the syntax section of the manual for more details)Stdlib
record.get_or
to get value from record supplying default value by @olorin37 in Add get value from record with supplying default #1920record.get_or
failing on field without definition by @yannham in [Fix] Avoidrecord.get_or
failing on field without definition #1946array.at_or
by @olorin37 in Add stdlib function array.at_or #1927std.enum.(from/to)_tag_and_arg
andstd.enum.map
to dynamically decompose and recompose an enum by @yannham in Add from/to_tag_and_arg #1939std.test
module withAssert
andassert_all
function to testing by @ajbt200128 in chore: add assert to the stdlib #1914Documentation
LSP
Tooling
nickel xxx
command to be JSON, YAML or TOML as well by @olorin37 in Remove different behaviour when single input #1902New Contributors
Full Changelog: 1.6.0...1.7.0
This discussion was created from the release 1.7.0.
Beta Was this translation helpful? Give feedback.
All reactions