Wondering if we really need a `declare` syntax; can't type conversions be used 
for this?

Instead of:
    
    
    declare seq[T] is Container[T]
    

we'd have:
    
    
    proc seqIsAContainer[T](s: seq[T]): Container[T] =
      Container[T](s)
    

([http://nim-lang.org/docs/manual.html#statements-and-expressions-type-conversions](http://forum.nim-lang.org///nim-lang.org/docs/manual.html#statements-and-expressions-type-conversions))

I guess what I'm saying is perhaps `declare` is just a `template` (aka syntax 
sugar) along the lines of:
    
    
    template declare(t1: typed, t2: typed) =
      when not (t1 is t2):
        {.error: $t1 % " does not match " % $t2 .}
      proc declare(tt: t1): t2 =
        t2(tt)
    

Just an idea. 

Reply via email to