Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trailing comma breaks record_type! and record_p! #770

Closed
lePerdu opened this issue Jul 31, 2019 · 1 comment · Fixed by #797
Closed

Trailing comma breaks record_type! and record_p! #770

lePerdu opened this issue Jul 31, 2019 · 1 comment · Fixed by #797

Comments

@lePerdu
Copy link
Contributor

lePerdu commented Jul 31, 2019

Examlpe

field_decl! { a, b };

type Record = record_type! {
    a => String,
    b => i64,
};

Error message

error: unexpected end of macro invocation
  --> src/main.rs:60:18
   |
60 |         b => i64,
   |                  ^ missing tokens in macro arguments

error: aborting due to previous error

The same thing happens with a trailing comma in record_p!. Removing the trailing comma resolves the error.

@Marwes
Copy link
Member

Marwes commented Aug 2, 2019

Should be easy to fix now that ? works in macros $(,)?

Marwes added a commit to Marwes/gluon that referenced this issue Aug 5, 2019
@bors bors bot closed this as completed in f35c0b9 Aug 5, 2019
Marwes added a commit to Marwes/gluon that referenced this issue Oct 27, 2019
<a name="v0.13.0"></a>
## v0.13.0 (2019-10-27)

#### Performance

*   Only do one hash lookup when creating a Symbol ([a709c71](gluon-lang@a709c71))
*   Shrink Type's size to 48 bytes (from 64) ([178180f](gluon-lang@178180f))
*   Avoid RefCell in Fixed* structurs (-1%) ([de32dbd](gluon-lang@de32dbd))
*   Avoid recursion in implicits.rs ([89eb836](gluon-lang@89eb836))
*   Only mark types with unbound generics as HAS_GENERICS ([3d835a8](gluon-lang@3d835a8))
*   Avoid computing the plain name in name_eq (-3%) ([a7ac9f8](gluon-lang@a7ac9f8))
* **check:**
  *  Use RefCell::get_mut when possible ([1244143](gluon-lang@1244143))
  *  Remove redundant operations in union ([f3d4203](gluon-lang@f3d4203))
  *  No need to lookup the type again before querying the level ([5e4efe3](gluon-lang@5e4efe3))
  *  Remove some branches in the occurs check¨ ([03e7c3b](gluon-lang@03e7c3b))
  *  Only initialize the variable generator when it is necessary (-3%) ([793b658](gluon-lang@793b658))
  *  Only do one lookup/insertion on the implicit definition map ([0ea13ff](gluon-lang@0ea13ff))
  *  Narrow down the implicit parititioning further (-10%) ([a9c965b](gluon-lang@a9c965b))
  *  Avoid looking through metadata when checking for an implicit type ([4a3662e](gluon-lang@4a3662e))
  *  Only add implicit fields if the binding is implicit ([da861eb](gluon-lang@da861eb), breaks [#](https://github.com/gluon-lang/gluon/issues/))
* **optimize:**  Allocate core syntax directly into arenas ([723ec4d](gluon-lang@723ec4d))
* **parser:**
  *  Shrink the Token type and remove it's need to Drop ([3016f25](gluon-lang@3016f25))
  *  Simplify tokenization iterators ([c7061c7](gluon-lang@c7061c7))
* **vm:**
  *  Add function inlining ([5093137](gluon-lang@5093137))
  *  Eliminate redundant match expressions ([945fb83](gluon-lang@945fb83))
  *  Implement inter-module dead code elimination ([ab1b1b8](gluon-lang@ab1b1b8))
  *  Avoid tracing global values unless we are in the root gc (-7%) ([48a5313](gluon-lang@48a5313))
  *  Avoid the bounds check when fetching instructions ([c2778e7](gluon-lang@c2778e7))
  *  Faster updates to the stack frame ([2b94a3a](gluon-lang@2b94a3a))
  *  Cache the frame offset for the stack (-20%) ([0469cb2](gluon-lang@0469cb2))
  *  Copy instead of clone unrooted gc values ([a0396f4](gluon-lang@a0396f4))

#### Breaking Changes

*   Replace Compiler with the ThreadExt trait ([c16132e](gluon-lang@c16132e), breaks [#](https://github.com/gluon-lang/gluon/issues/))
* **check:**  Only add implicit fields if the binding is implicit ([da861eb](gluon-lang@da861eb), breaks [#](https://github.com/gluon-lang/gluon/issues/))

#### Bug Fixes

*   Don't leak implicit bindings into adjacent scopes ([5681ffc](gluon-lang@5681ffc), closes [gluon-lang#783](gluon-lang#783))
*   ignore formatting in std.test due to a bug ([bdccee6](gluon-lang@bdccee6))
*   rerefix formatting ([3116616](gluon-lang@3116616))
*   refix formatting ([fcb7f0b](gluon-lang@fcb7f0b))
*   fix formatting and apply naming suggesions ([6bb0d87](gluon-lang@6bb0d87))
*   Make the behaviour consistent for `Show Char` ([0ff8987](gluon-lang@0ff8987))
*   Avoid infinite loops/extremely slow optimization ([dc7ec72](gluon-lang@dc7ec72))
*   Expand macros inside macros ([5a29433](gluon-lang@5a29433))
*   Invalidate text properly so rexpect tests work ([92e4508](gluon-lang@92e4508))
*   Don't depend on ansi_term in windows to make windows 7 work ([58e2a8b](gluon-lang@58e2a8b), closes [gluon-lang#777](gluon-lang#777))
*   Add tests and fix the regression with clone_userdata ([df07872](gluon-lang@df07872))
*   Ensure that threads are dropped when using child threads ([b9efb51](gluon-lang@b9efb51))
* **check:**  Handle aliases better in `do` ([770e52e](gluon-lang@770e52e), closes [gluon-lang#766](gluon-lang#766))
* **repl:**  make the REPL respect --no-std ([e797470](gluon-lang@e797470))
* **std:**  export missing assertions in std.test ([41f4fc5](gluon-lang@41f4fc5))
* **vm:**
  *  Don't (rust) panic in string.split_at ([50f937b](gluon-lang@50f937b), closes [gluon-lang#757](gluon-lang#757))
  *  Accept trailing comma in record macros ([f35c0b9](gluon-lang@f35c0b9), closes [gluon-lang#770](gluon-lang#770))

#### Features

*   Use implicit Monoids in std.foldable ([295b8c3](gluon-lang@295b8c3))
*   Add a mutable string type to the ST monad ([9ec946b](gluon-lang@9ec946b))
*   Allow attributes to be specified on fields inside types ([fb35db5](gluon-lang@fb35db5))
*   Provide std.effect.io as a mirror of std.io ([66e49b3](gluon-lang@66e49b3))
*   Replace Compiler with the ThreadExt trait ([c16132e](gluon-lang@c16132e), breaks [#](https://github.com/gluon-lang/gluon/issues/))
*   Use salsa for incremental compilation ([7bc8253](gluon-lang@7bc8253))
*   Add history hints and bracket highlight to the REPL ([10ef8cd](gluon-lang@10ef8cd))
*   Use line/column numbers in lambda names ([201fdfb](gluon-lang@201fdfb))
* **codegen:**  Map Rust's struct enums to records in Gluon. ([afb682e](gluon-lang@afb682e))
* **repl:**  add --no-std option to gluon.exe ([f2c1819](gluon-lang@f2c1819))
* **std:**
  *  add ordering assertions ([3efac99](gluon-lang@3efac99))
  *  add a few functions to std.test & std.effect.error ([58e0043](gluon-lang@58e0043))
* **vm:**  Make macro errors implement PartialEq, Eq, Hash and Clone ([039825a](gluon-lang@039825a))
@Marwes Marwes mentioned this issue Oct 27, 2019
bors bot added a commit that referenced this issue Oct 27, 2019
797: Version 0.13.0 r=Marwes a=Marwes

<a name="v0.13.0"></a>
## v0.13.0 (2019-10-27)

This version mostly contains performance improvements, both during compilation and execution. The most notable of which is that gluon now has function inlining and constant folding. This lets simple calls like `1 + 2` be optimized into `3` at compile time and `x + 1` are now compiled as the primitive addition instruction instead of calling `std.int.num.(+)` first. Optimizations is enabled by default but can be disabled via the ´optimize` compiler setting. Together with some other optimizations, the factorial tests have received a 4x speedup. There are still more work to do on optimizing the virtual machine however as lua still comes out ahead by another 4x speedup.

Some breaking changes have occurred, the `gluon::Compiler` struct is no more. Instead, all it's methods are exposed via the `gluon::ThreadExt` trait which are implemented on `Thread/RootedThread` which should make it much easier to use.

```rust
Compiler::new().run_expr(&vm, ...)
// Change to
use gluon::ThreadExt;
vm.run_expr(...)
```

The compilation process has been largely rewritten and is now built on top of https://github.com/salsa-rs/salsa which enables better control over how compilation steps are cached. This may lead to some regressions in memory usage (please report!) but should also allow for less memory usage in the long run for apps that needs it as well.

In the language itself, the most significant addition is the `std.effect.io` module. This is an exact mirror of `std.io` but it uses effects which fixes the annoyance of having to write `lift` to move `IO` actions into `Eff` everywhere.

#### Performance

*   Only do one hash lookup when creating a Symbol ([a709c71](a709c71))
*   Shrink Type's size to 48 bytes (from 64) ([178180f](178180f))
*   Avoid RefCell in Fixed* structurs (-1%) ([de32dbd](de32dbd))
*   Avoid recursion in implicits.rs ([89eb836](89eb836))
*   Only mark types with unbound generics as HAS_GENERICS ([3d835a8](3d835a8))
*   Avoid computing the plain name in name_eq (-3%) ([a7ac9f8](a7ac9f8))
* **check:**
  *  Use RefCell::get_mut when possible ([1244143](1244143))
  *  Remove redundant operations in union ([f3d4203](f3d4203))
  *  No need to lookup the type again before querying the level ([5e4efe3](5e4efe3))
  *  Remove some branches in the occurs check¨ ([03e7c3b](03e7c3b))
  *  Only initialize the variable generator when it is necessary (-3%) ([793b658](793b658))
  *  Only do one lookup/insertion on the implicit definition map ([0ea13ff](0ea13ff))
  *  Narrow down the implicit partitioning further (-10%) ([a9c965b](a9c965b))
  *  Avoid looking through metadata when checking for an implicit type ([4a3662e](4a3662e))
  *  Only add implicit fields if the binding is implicit ([da861eb](da861eb), breaks [#](https://github.com/gluon-lang/gluon/issues/))
* **optimize:**  Allocate core syntax directly into arenas ([723ec4d](723ec4d))
* **parser:**
  *  Shrink the Token type and remove it's need to Drop ([3016f25](3016f25))
  *  Simplify tokenization iterators ([c7061c7](c7061c7))
* **vm:**
  *  Add function inlining ([5093137](5093137))
  *  Eliminate redundant match expressions ([945fb83](945fb83))
  *  Implement inter-module dead code elimination ([ab1b1b8](ab1b1b8))
  *  Avoid tracing global values unless we are in the root gc (-7%) ([48a5313](48a5313))
  *  Avoid the bounds check when fetching instructions ([c2778e7](c2778e7))
  *  Faster updates to the stack frame ([2b94a3a](2b94a3a))
  *  Cache the frame offset for the stack (-20%) ([0469cb2](0469cb2))
  *  Copy instead of clone unrooted gc values ([a0396f4](a0396f4))

#### Breaking Changes

*   Replace Compiler with the ThreadExt trait ([c16132e](c16132e), breaks [#](https://github.com/gluon-lang/gluon/issues/))
* **check:**  Only add implicit fields if the binding is implicit ([da861eb](da861eb), breaks [#](https://github.com/gluon-lang/gluon/issues/))

#### Bug Fixes

*   Don't leak implicit bindings into adjacent scopes ([5681ffc](5681ffc), closes [#783](#783))
*   ignore formatting in std.test due to a bug ([bdccee6](bdccee6))
*   rerefix formatting ([3116616](3116616))
*   refix formatting ([fcb7f0b](fcb7f0b))
*   fix formatting and apply naming suggesions ([6bb0d87](6bb0d87))
*   Make the behaviour consistent for `Show Char` ([0ff8987](0ff8987))
*   Avoid infinite loops/extremely slow optimization ([dc7ec72](dc7ec72))
*   Expand macros inside macros ([5a29433](5a29433))
*   Invalidate text properly so rexpect tests work ([92e4508](92e4508))
*   Don't depend on ansi_term in windows to make windows 7 work ([58e2a8b](58e2a8b), closes [#777](#777))
*   Add tests and fix the regression with clone_userdata ([df07872](df07872))
*   Ensure that threads are dropped when using child threads ([b9efb51](b9efb51))
* **check:**  Handle aliases better in `do` ([770e52e](770e52e), closes [#766](#766))
* **repl:**  make the REPL respect --no-std ([e797470](e797470))
* **std:**  export missing assertions in std.test ([41f4fc5](41f4fc5))
* **vm:**
  *  Don't (rust) panic in string.split_at ([50f937b](50f937b), closes [#757](#757))
  *  Accept trailing comma in record macros ([f35c0b9](f35c0b9), closes [#770](#770))

#### Features

*   Use implicit Monoids in std.foldable ([295b8c3](295b8c3))
*   Add a mutable string type to the ST monad ([9ec946b](9ec946b))
*   Allow attributes to be specified on fields inside types ([fb35db5](fb35db5))
*   Provide std.effect.io as a mirror of std.io ([66e49b3](66e49b3))
*   Replace Compiler with the ThreadExt trait ([c16132e](c16132e), breaks [#](https://github.com/gluon-lang/gluon/issues/))
*   Use salsa for incremental compilation ([7bc8253](7bc8253))
*   Add history hints and bracket highlight to the REPL ([10ef8cd](10ef8cd))
*   Use line/column numbers in lambda names ([201fdfb](201fdfb))
* **codegen:**  Map Rust's struct enums to records in Gluon. ([afb682e](afb682e))
* **repl:**  add --no-std option to gluon.exe ([f2c1819](f2c1819))
* **std:**
  *  add ordering assertions ([3efac99](3efac99))
  *  add a few functions to std.test & std.effect.error ([58e0043](58e0043))
* **vm:**  Make macro errors implement PartialEq, Eq, Hash and Clone ([039825a](039825a))

Co-authored-by: Markus Westerlind <marwes91@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants