We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crystal allows to parametrize generics by integer:
class A(T) end puts A(2).new()
#<A(2):0x10fb4dff0>
Unfortunately, this doesn't work with variadic generics:
class A(*T) end puts A(2).new()
Error in tst.cr:2: argument to Tuple must be a type, not 2 puts A(2).new() ^
Related to #4337
The text was updated successfully, but these errors were encountered:
Use case? I think it's fine that it doesn't compile.
Sorry, something went wrong.
It could be useful for statically typed n-dimensional arrays when you don't know n in advance.
Imagine matrix multiplication operator that accepts only right inputs:
def dot(first : Matrix(N, M), second : Matrix(M, K)) : Matrix(N, K) .... end
This wouldn't work for n-dimensional case.
No branches or pull requests
Crystal allows to parametrize generics by integer:
Unfortunately, this doesn't work with variadic generics:
Related to #4337
The text was updated successfully, but these errors were encountered: