You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The root cause is that strappend.strJoin() is interpreted as strJoin(strAppend) using strAppend from fun1.nim, but that was really not obvious in my original scenario, especially given that fun1 was not directly imported by main.nim (only indirectly, via a re-export in all.nim), and import ./strappend was hidden by hidden by conditional compilation
proposal
P1: show: expression: strJoin(strAppend) in the ambiguous call error message, as is done for type mismatch error, eg:
Error: type mismatch: got <proc (x: varargs[typed]){.gcsafe, locks: 0.}>
but expected one of:
macro strAppend(s: var string; args: varargs[typed]): untyped
expression: strappend(echo)
echo .strappend.strJoin("asfd")
^
P2 (in addition to P1): more controversial, but IMO would solve a number of problems, including UFCS with fully qualified name, as well as removing ambiguities like in this issue:
allow using a symbol other than . to indicate fully qualiified name access, eg: strappend::strJoin (as in C++) or strappend@strJoin where that symbol would bind stronger than . so that it'd work in UFCS chains, eg: getFoo.std::getBar.baz()
(as originally suggested here: https://github.com/nim-lang/Nim/issues/8013#issuecomment-413332220)
The text was updated successfully, but these errors were encountered:
I got this cryptic error message, where it would seem there was no ambiguity given that I specified fully qualified name
strappend.strJoin
:Here's the full code to reproduce (after I reduced it)
The root cause is that
strappend.strJoin()
is interpreted asstrJoin(strAppend)
using strAppend from fun1.nim, but that was really not obvious in my original scenario, especially given that fun1 was not directly imported by main.nim (only indirectly, via a re-export in all.nim), andimport ./strappend
was hidden by hidden by conditional compilationproposal
expression: strJoin(strAppend)
in theambiguous call
error message, as is done fortype mismatch error
, eg:allow using a symbol other than
.
to indicate fully qualiified name access, eg:strappend::strJoin
(as in C++) orstrappend@strJoin
where that symbol would bind stronger than.
so that it'd work in UFCS chains, eg:getFoo.std::getBar.baz()
(as originally suggested here: https://github.com/nim-lang/Nim/issues/8013#issuecomment-413332220)
The text was updated successfully, but these errors were encountered: