Quick updated - I now have this sorta working now by removing the second 
template and rewriting the first as 
    
    
    template `?.`*[T,U](left: T, right: proc (x: T): U):U =
      if ?left:
        right(left)
      else:
        var res: U
        res
     
     let s = @["one"]
     assert((s[0]?.len) == 3)
     assert((s[1]?.len) == 0)
    
    
    Run

Still needs some extra love to support more use cases (varargs etc..)

Reply via email to