Re: Empty sequence of specific type given problems when compiling with "cpp"

2019-11-21 Thread Vindaar
Ah yes, indeed. If DICT is just a proc that takes a Context, this also works btw: let ret = DICT(@[]) Run The compiler can deduce the type of the empty seq itself from the args of proc DICT(c: Context). Although personally if the use case of an empty seq as the argum

Re: Empty sequence of specific type given problems when compiling with "cpp"

2019-11-21 Thread drkameleon
Spot on! (with one slight difference: given that Context=seq[int,int], it has to be: DICT(newSeq[(int,int)]()) Run Thanks! ;-)

Re: Empty sequence of specific type given problems when compiling with "cpp"

2019-11-21 Thread Vindaar
If I'm not missing something, you should call newSeq instead: var ret = DICT(newSeq[Context]()) Run But of course, any Nim code you write should either error during nim compilation or compile successfully.

Empty sequence of specific type given problems when compiling with "cpp"

2019-11-21 Thread drkameleon
I have this line of code: var ret = DICT(cast[Context](@[])) Run DICT takes Context as a param. And a Context is nothing but a seq[(int,int)]. Obviously, an empty sequence can be anything, so I cast it to Context. Now, the thing is: when I compile it with "c", everyth