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

{.procvar.} still used despite being the default and not documented #12975

Open
timotheecour opened this issue Dec 27, 2019 · 8 comments
Open

Comments

@timotheecour
Copy link
Member

timotheecour commented Dec 27, 2019

{.procvar.} is still being used but is not documented:
The only doc is from ast.nim (but it doesn't end up in docs):

sfProcvar,        # proc can be passed to a proc var

and yet, apparently procvar is now on by default according to #2172 (comment)

proposal

  • remove remaining procvar annotations
  • remove wProcVar
  • remove sfProcvar (?)
  • remove all remaining mentions of procvar
@Clyybber
Copy link
Contributor

procvar is default and effectively gone. No need to document it. See #2172

@timotheecour timotheecour changed the title [doc] {.procvar.} not documented {.procvar.} still used but was documented Dec 27, 2019
@timotheecour timotheecour changed the title {.procvar.} still used but was documented {.procvar.} still used despite being the default and not documented Dec 27, 2019
@timotheecour
Copy link
Member Author

timotheecour commented Dec 27, 2019

effectively gone but stil 94 mentions in nim sources; the fact that it's still used yet un-documented makes it even more confusing for users encountering this pragma, who wonder what it does, etc; either we get rid of it (at very least in stdlib), or (easy fix), we document that it's a noop

@Clyybber
Copy link
Contributor

Then it should be removed, and not documented, but I see you edited your issue to reflect that :)

@kaushalmodi
Copy link
Contributor

kaushalmodi commented May 15, 2020

I stumbled across this same issue today:

All I wanted to do was attempt to send a PR for unicode.nim, but then I saw the {.procvar.} pragma sprinkled for some procs and not for others. That led me down the rabbit hole and finally to this issue.

/cc @Araq

kaushalmodi added a commit to kaushalmodi/Nim that referenced this issue May 15, 2020
@kaushalmodi
Copy link
Contributor

#14359 fixes this partially.

Araq pushed a commit that referenced this issue May 15, 2020
@kaushalmodi
Copy link
Contributor

kaushalmodi commented May 15, 2020

@Araq Thanks for merging that PR.

Now grepping for '\bprocvar\b' in the Nim repo returns these:

tests/errmsgs/tcannot_capture_builtin.nim
2:errormsg: "'+' cannot be passed to a procvar"

compiler/sempass2.nim
488:    localError(conf, n.info, "'$1' cannot be passed to a procvar" % n.sym.name.s)

compiler/wordrecg.nim
137:    "compilerproc", "core", "procvar", "base", "used",

doc/manual_experimental.rst
1765:However, one of the overloaded methods calls a procvar which is

doc/manual.rst
3230:  let procVar = (proc(x: string))(p)
3231:  procVar("a")
7319:indirectly; so the ``thread`` pragma implies ``procvar``.

I am not sure how to remove or modify procvar references in those.

Apart those those, grepping just 'procvar' returns a lot more hits like sfProcVar, wProcVar and others, which I don't know how to deal with.

@timotheecour
Copy link
Member Author

well looks like procvar distinction still matters after all; I just retried #2172 (comment) and still relevant:

proc `+`*(x: int): int {.magic: "UnaryPlusI", noSideEffect.}
proc foo[T](a: T,
          b: T,
          f: proc(x: T, y: T): T): T =
  return f(a,b)

let a = 11
let b = 10

let z = foo(a,b,`+`)

echo z
Error: '+' cannot be passed to a procvar
  let z = foo(a,b,`+`)

@Clyybber
Copy link
Contributor

Not related to procvar though, but to the fact that + is a builtin. The error message just needs to be updated.

EchoPouet pushed a commit to EchoPouet/Nim that referenced this issue Jun 13, 2020
metagn added a commit to metagn/Nim that referenced this issue Aug 11, 2022
refs nim-lang#12975. doesn't close it because wProcvar isn't removed
Araq pushed a commit that referenced this issue Aug 24, 2022
refs #12975. doesn't close it because wProcvar isn't removed
metagn pushed a commit to nim-lang/asyncftpclient that referenced this issue Sep 14, 2022
capocasa pushed a commit to capocasa/Nim that referenced this issue Mar 31, 2023
refs nim-lang#12975. doesn't close it because wProcvar isn't removed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants