To work through this list a bit
    
    
    type MyGeneric[A;B;C;D: static int, E: static float] = object
    
    proc doThing(gen: MyGeneric) = discard # A generic type without parameters 
is a typeclass
    
    
    Run

3 is a compiler bug.

I think a more sensible approach to last type is to use a procedure as follows:
    
    
    proc lastType[T](a: openarray[T]): auto =
      when T is (seq or array):
        default(T).lastType()
      else:
        default(T)
    
    var
      a: seq[seq[array[1, seq[int]]]]
      b: array[10, seq[seq[seq[float]]]]
    assert typeof(lastType(a)) is int
    assert typeof(lastType(b)) is float
    
    
    Run

For your live chunk example
    
    
    type LiveChunk[T; Size: static int] = object
      data: array[Size, T]
      active: set[0..Size]
    
    template liveChunk(typ: typedesc, size: static int): untyped =
      LiveChunk[typ, size] # I dont know why this is desired to be frank, or 
steve even.
    
    
    Run

Reply via email to