new syntax for lvalue references: var b {.byaddr.} = expr (#13508)

* new syntax for lvalue references: `var b {.byaddr.} = expr`
* on type mismatch, `???(0, 0)` not shown anymore
* * compiler now lowers `var a: {.foo.}: MyType = expr` to foo(a, MyType, expr)
* new pragmas.byaddr defined in pure library code exploiting this lowering
* skip `template foo() {.pragma.}`
This commit is contained in:
Timothee Cour 2020-03-23 03:15:45 -07:00 • committed by GitHub
commit 913bc95964
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 139 additions and 1 deletions

View file

@ -149,7 +149,7 @@ echo f
- `std/oswalkdir` was buggy, it's now deprecated and reuses `std/os` procs
- `net.newContext` now performs SSL Certificate checking on Linux and OSX.
Define `nimDisableCertificateValidation` to disable it globally.
- new syntax for lvalue references: `var b {.byaddr.} = expr` enabled by `import pragmas`
## Language additions
@ -159,6 +159,9 @@ echo f
- `=sink` type bound operator is now optional. Compiler can now use combination
of `=destroy` and `copyMem` to move objects efficiently.
- `var a {.foo.}: MyType = expr` now lowers to `foo(a, MyType, expr)` for non builtin pragmas,
enabling things like lvalue references, see `pragmas.byaddr`
## Language changes
- Unsigned integer operators have been fixed to allow promotion of the first operand.