yglukhov / variant

Variant type and type matching for Nim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

variant.getTypeid clashes with stdlib PR for typetraits.getTypeid

timotheecour opened this issue · comments

@yglukhov just opening a discussion:
nim-lang/Nim#13305 introduces getTypeid(T): int which seems better, simpler, faster (AFAIU) than variant.getTypeid; currently my PR fails because it clashes with ambiguous symbol error:

C:\Users\VssAdministrator\.nimble\pkgs\nimx-0.1\nimx\class_registry.nim(53, 61) Error: ambiguous call; both typetraits.getTypeid(t: typedesc) [declared in d:\a\1\s\lib\pure\typetraits.nim(19, 6)] and variant.getTypeId(t: typed) [declared in C:\Users\VssAdministrator\.nimble\pkgs\variant-0.2.10\variant.nim(126, 7)] match for: (type RootRef)

that PR is not finalized (nor accepted etc) yet but I'm wondering what's the best course of action;
one easy option is to simply change: getTypeId => variant.getTypeId in class_registry
but down the line it'd be maybe best to either rename variant.getTypeId or use the new typetraits.getTypeId

first question for you is: does typetraits.getTypeId provide a suitable replacement for variant.getTypeId ? feel free to try out the PR

I will be happy to ditch variant.getTypeId for typetraits as long as it passes my tests, but currently it fails. You can check it yourself, just comment out getTypeId impl in variant.nim, add import typetraits, and run nimble test :)