I don't think it's possible, actually. By using pars, you force non-standard 
operator (let's assume : could be an operator) precedence. Then, it's possible 
for ? to just eat an untyped block, not caring too deeply about whenever : is 
really an operator or not. But without pars, things are different.

The only thing I can think of is using a visually similar cond ? x ::: y and 
then: 
    
    
    macro `:::`(a, b): untyped =
       a.expectKind nnkInfix
       a.expectLen 3
       assert $(a[0].ident) == "?"
       
       let cond = a[1]
       let lhs  = a[2]
       let rhs  = b
       
       template impl(a,b,c) =  # here comes your implementation
                               # I'll just use if-else as an example
          if a:
             b
          else:
             c
       
       result = getAst(impl(cond,lhs,rhs))
    
    # example usage
    let
      a = 7
      b = 3
      x = (a > b ? a ::: b)
    echo x
    

Reply via email to