How to make a generic type parameter be late bound for evaluating proc parameter types?

2023-12-02 Thread icebergg
In the code below, the generic parameter hits the `else` clause even if it is `int`. How to make the parameter be late bound in this use case? Making the proc a template did not help. template IntToStr(t: typedesc): auto = when t is int: string else:

experimental: "inferGenericTypes" -- unknown experimental feature

2023-11-05 Thread icebergg
That works, thank you

experimental: "inferGenericTypes" -- unknown experimental feature

2023-11-05 Thread icebergg
As in the title, do I need to enable some other option or use a particular version of the compiler for `{.experimental: "inferGenericTypes".}` to work? It gets rejected for me with `unknown experimental feature`. Thanks!

Learning Nim - some problems with nested template / macro / generic code

2023-11-04 Thread icebergg
Thank you. My understanding was that `typed` should be used when the code is meaningful in itself, like here. Is this behaviour expected?

Learning Nim - some problems with nested template / macro / generic code

2023-11-03 Thread icebergg
I'm checking out Nim, have read most of the manual - there are a lot of things I like! I'm however having problems with nested template / macro / generic code, which I do not know why it doesn't work: import iterrr proc testIterrr() = let m = @[1, 2, 3].items.iterrr