You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first one just exists for C interop and the second one creates an array. It is possible to accept any type with the second variant by using a void reference but the issue with that is that it's purely a runtime thing and you need to inspect the runtime type of your arguments.
def varargs(a: type...)
This could be the third variant which basically passes a tuple of the types which can be examined at compile time.
Doing so could be done like this:
def varargs(a: type...) {
#if a.length == 1 {
const first = a[0]
type F = type_of a[0]
...
}
}
The text was updated successfully, but these errors were encountered:
Right now there are two forms of varargs:
The first one just exists for C interop and the second one creates an array. It is possible to accept any type with the second variant by using a void reference but the issue with that is that it's purely a runtime thing and you need to inspect the runtime type of your arguments.
This could be the third variant which basically passes a tuple of the types which can be examined at compile time.
Doing so could be done like this:
The text was updated successfully, but these errors were encountered: