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

Using a template as a routine pragma no longer works #9614

GULPF opened this issue Nov 3, 2018 · 2 comments


None yet
2 participants
Copy link

commented Nov 3, 2018

From the manual:

Whole routines (procs, iterators etc.) can also be passed to a template or a macro via the pragma notation:

template m(s: untyped) = discard

proc p() {.m.} = discard

This is a simple syntactic transformation into:

template m(s: untyped) = discard

 proc p() = discard

This works in 0.19.0, but with latest devel it gives Error: invalid pragma: m. It only fails when a template is used, with a macro it still works.


This comment has been minimized.

Copy link
Member Author

commented Nov 4, 2018

Git bisect says the regression was introduced in 3345889. Ping @LemonBoy


This comment has been minimized.

Copy link

commented Nov 4, 2018

Are you sure it's a regression?


template dbTable(name: string, table_space: string = "") {.pragma.}
template dbKey(name: string = "", primary_key: bool = false) {.pragma.}
template dbForeignKey(t: type) {.pragma.}
template dbIgnore {.pragma.}

I think it's the new syntax, but the old one probably requires a deprecation period and/or a big warning in the changelog.

Edit: seems like the new {.pragma.} for template is only for custom annotations and does not allow implementation.

@mratsim mratsim added Documentation and removed Documentation labels Nov 4, 2018

@Araq Araq closed this in bc8cea2 Dec 5, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.