I have just added that to my code generator, but the funny fact is that this will not work when there is only one proc with that name: #proc getLength(i: int): int = # sizeof(i) proc getLength(s: string): int = s.len const length = (proc(s: string): int)(getLength) echo length("alias") Run /tmp/hhh/t.nim(8, 3) Error: invalid type for const: proc (s: string): int{.closure.} Run
Maybe I can collect all proc names in a hashset and generate different code when there are single or multiple names in the module.