if you import it from another module, you can use 'as' key http://nim-lang.org/docs/manual.html#modules-module-names-in-imports
EDIT: im wrong, but this should work:
proc exampleProc(a, b: int): bool = a == b
let ep = exampleProc
assert ep(5, 5)
Use const instead of let to avoid a level of indirection. E.g.:
proc foo(x: int) = echo x
const bar = foo
bar 10
proc caculateFirst() = echo 1
to something like:
proc caculate(n: int) = echo n
in that case is a template sutiable, or it has any disadvantage and would be better a proc with inline?
in that case is a template sutiable,
From the manual:
Style note: For code readability, it is the best idea to use the least powerful programming construct that still suffices. So the "check list" is:
Use an ordinary proc/iterator, if possible.
Else: Use a generic proc/iterator, if possible.
Else: Use a template, if possible.
Else: Use a macro.
So I think we should use a plain proc, maybe with inline pragma. ( That was from an answer of Jehan, unfortunately I do not remember all details about when inline pragma is really useful ...)
[EDIT]
See this thread about Jehan's comment on inline:
Looks like this also works (might not have worked then, but it works with current Nim devel):
proc foo(x: int) = echo x
template bar(x) = foo x
bar 10
And similarly (for future readers), this kind of usage also works, for non-procs:
var a = 200
let b = addr a
b[] = 300
echo a
Though it's not entirely safe.
Also relates to this github ticket: