IMHO, in a meta-programming-heavy language like Nim, there shouldn't even be a 
special type of bracket used for generic type parameters, `()` is good enough. 
A "generic" just returns a concrete `type` or `proc` when called with type 
parameters at compile time. The syntax element for call parameters is 
parentheses. We don't use special syntax elements for compile time code in 
other cases, so why do it just for generic type parameters?
    
    
    type
      A[T: SomeNumber] = object   # this is just a type constructor..
        x: T
      
      B = A[int]                  # called at compile time..
      
      A(T: SomeNumber) = object   # so why not write..
        x: T
      
      B = A(T: int)               #  this instead..
      B = A(int)                  # or this for convenience?
    
    let b = B(x: 2)
    
    proc printSquared[T](o: A[T]) =  # printSquared will produce a concrete proc
      echo o.x * o.x                 # for a type parameter T at compile time..
    
    printSquared[int](b)             # like this..
    
    proc printSquared(T)(o: A[T]) =  # so why not write it like this
      echo o.x * o.x
    
    printSquared(int)(b)             # it's just a call returning a proc,
                                     # so why use brackets for the type 
parameter?
                                     # we don't do that for compile-time procs
                                     # and templates either.
    
    
    Run

Of course the type parameter in the call to `printSquared` is redundant because 
of type inference, it was kept in there for clarity.

Disclaimer: I'm not a compiler sage, there may be a good reason to use `[]` I 
never heard about.

Reply via email to