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

Closed
GULPF opened this issue Nov 3, 2018 · 2 comments

Comments

Projects
None yet
2 participants
@GULPF
Copy link
Member

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

m:
 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.

@GULPF

This comment has been minimized.

Copy link
Member Author

commented Nov 4, 2018

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

@mratsim

This comment has been minimized.

Copy link
Collaborator

commented Nov 4, 2018

Are you sure it's a regression?

See https://nim-lang.org/docs/manual.html#implementation-specific-pragmas-custom-annotations

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.