Hi Hackers,

I need to apply different logic in template if the argument has a particular 
type or is untyped expression. Calling getType() in macro triggers compilation 
failure for untyped expression.

Ideally, something like this. Any ideas are appreciated.
    
    
    template filter(expr : untyped) =
      when type(expr) is seq[bool]:  # currently causes compilation failure if 
expr is untyped
         .....
      elif type(expr) is seq[int]:
         ....
      else: # expression has no type, inject additional variables to make 
expression typed
         ....
    
    

Thank you 

Reply via email to