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

Macros and zero-argument custom pragmas can't be defined on the same proc #10994

Closed
dawkot opened this issue Apr 10, 2019 · 2 comments · Fixed by #19406
Closed

Macros and zero-argument custom pragmas can't be defined on the same proc #10994

dawkot opened this issue Apr 10, 2019 · 2 comments · Fixed by #19406

Comments

@dawkot
Copy link

dawkot commented Apr 10, 2019

import macros

macro foo(x): untyped = x
template bar {.pragma.}

proc a {.bar.} = discard # works
proc b {.bar, foo.} = discard # doesn't
@metagn
Copy link
Collaborator

metagn commented Jan 3, 2022

This code works now, unless I am missing something? How did this not work in the first place?

@ringabout
Copy link
Member

How did this not work in the first place?

It didn't work before 1.0.2: /usercode/in.nim(7, 10) Error: invalid pragma: bar

metagn added a commit to metagn/Nim that referenced this issue Jan 17, 2022
Araq pushed a commit that referenced this issue Jan 20, 2022
* New/better macro pragmas, make some experimental

fix #15920, close #18212, close #14781, close #6696,
close nim-lang/RFCs#220

Variable macro pragmas have been changed to
only take a unary section node.
They can now also be applied in sections with multiple variables,
as well as `const` sections. They also accept arguments.

Templates now support macro pragmas, mirroring other routine types.

Type and variable macro pragmas have been made experimental.
Symbols without parentheses instatiating nullary macros or templates
has also been documented in the experimental manual.

A check for a redefinition error based on the left hand side of variable
definitions when using variable macro pragmas was disabled.
This nerfs `byaddr` specifically, however this has been documented as
a consequence of the experimental features `byaddr` uses.

Given how simple these changes are I'm worried if I'm missing something.

* accomodate compiler boot

* allow weird pragmas

* add test for #10994

* remove some control flow, try remove some logic
PMunch pushed a commit to PMunch/Nim that referenced this issue Mar 28, 2022
* New/better macro pragmas, make some experimental

fix nim-lang#15920, close nim-lang#18212, close nim-lang#14781, close nim-lang#6696,
close nim-lang/RFCs#220

Variable macro pragmas have been changed to
only take a unary section node.
They can now also be applied in sections with multiple variables,
as well as `const` sections. They also accept arguments.

Templates now support macro pragmas, mirroring other routine types.

Type and variable macro pragmas have been made experimental.
Symbols without parentheses instatiating nullary macros or templates
has also been documented in the experimental manual.

A check for a redefinition error based on the left hand side of variable
definitions when using variable macro pragmas was disabled.
This nerfs `byaddr` specifically, however this has been documented as
a consequence of the experimental features `byaddr` uses.

Given how simple these changes are I'm worried if I'm missing something.

* accomodate compiler boot

* allow weird pragmas

* add test for nim-lang#10994

* remove some control flow, try remove some logic
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.

4 participants