major improvements to std/wrapnils: optimal codegen, case objects, lvalue semantics (#18435)

* wrapnils now generates optimal code; also handles case objects
* changelog
* unsafeAddr => addr
This commit is contained in:
Timothee Cour 2021-07-06 21:04:36 -07:00 • committed by GitHub
commit d1447fe25d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 329 additions and 109 deletions

View file

@ -279,6 +279,10 @@
issues like https://github.com/nim-lang/Nim/issues/13063 (which affected error messages)
for modules importing `std/wrapnils`.
Added `??.` macro which returns an `Option`.
`std/wrapnils` can now be used to protect against `FieldDefect` errors in
case objects, generates optimal code (no overhead compared to manual
if-else branches), and preserves lvalue semantics which allows modifying
an expression.
- Added `math.frexp` overload procs. Deprecated `c_frexp`, use `frexp` instead.