Hello folks,
Does anyone know why templates don't "auto-import" symbols defined in their
residence file? :( Minimal example:
# test.nim
import strutils
template test_template*() =
echo (1.0/3.0).formatFloat(precision=3)
proc test_proc*() =
echo (1.0/3.0).formatFloat(precision=3)
Run
# other.nim
import test
test_proc() # ok
test_template() # fail:
# /tmp/other.nim(4, 14) template/generic instantiation of `test_template`
from here
# /tmp/test.nim(5, 17) Error: attempting to call undeclared routine:
'formatFloat'
Run
Is it a new feature or a bug? I think it worked in a different way some time
ago.
Nim Compiler Version 1.1.1 [Linux: amd64]
Compiled at 2020-02-25
git hash: db540a0223480134598fb4806c55510cdef36bf1
Run