Using Generic with inner constants

I must be missing something, but is there a way to do this?

class Foo(T)
  BOX = [] of T

# undefined constant T
#alias Toy = Foo(String)

# syntax error

# undefined constant T

I want to be able to access the BOX constant, but each of these ways seems to throw an error.

1 Like

Generics can’t have generic constants, sorry. You can do Foo::BOX but T doesn’t exist there.

1 Like

Cool, thanks. I think I can do a work around.