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

{.deprecated.} gives false warning on proc with typedesc arg #6436

Closed
mratsim opened this issue Sep 25, 2017 · 3 comments
Closed

{.deprecated.} gives false warning on proc with typedesc arg #6436

mratsim opened this issue Sep 25, 2017 · 3 comments

Comments

@mratsim
Copy link
Collaborator

mratsim commented Sep 25, 2017

I'm trying to deprecate some procs to use foo[T](arg) instead of foo(arg, T) syntax.

However deprecating foo(arg, T) gives deprecation warning even for foo[T](arg) syntax:

proc foo(size: int, T: typedesc): seq[T]  {.deprecated.}=
  result = newSeq[T](size)


proc foo[T](size: int): seq[T]=
  result = newSeq[T](size)


let bar = foo[int](10) # Warning foo is deprecated

echo bar
@zah
Copy link
Member

zah commented Sep 25, 2017

This is not related to the issue, but what problems did you have with the deprecated typedesc alternative? Overloading with typedesc is actually the better-supported and recommended API for mandatory type arguments.

@mratsim
Copy link
Collaborator Author

mratsim commented Sep 25, 2017

Familiarity and consistency. I type someProc[T](foo) almost everywhere and I end up typing the same for all procs even if I shouldn't.
Muscle memory is hard to beat so embrace it.

@narimiran
Copy link
Member

No false warnings on Nim 0.19.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants