Hey folks,
Is there an existing mechanism for allowing a converter to work with varargs? I'm expecting this to compile:
type MyInt = distinct int
converter toMyInt( i: int ): MyInt = MyInt(i)
proc doSomething( values: varargs[MyInt] ) =
discard
doSomething(1, 2, 3, 4)
I checked for any open issues, but didn't find anything related
Thanks!
Well, I don't know if a converter should be called in this case, however you can achieve what you want by specifying a conversion procedure in the varargs parameter type:
type MyInt = distinct int
proc toMyInt( i: int ): MyInt = MyInt(i)
# Specify a conversion procedure
proc doSomething( values: varargs[MyInt, toMyInt] ) =
discard
doSomething(1, 2, 3, 4)