-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
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
Function with variadic parameters in script. #255
Labels
TODO
It hasn't implemented yet.
Comments
Yeah, at the moment it's not supported, thanks for the suggestion, I should definitely add this to the todo list. |
I can achieve similar behavior via callable object and native code in this branch. I still have no idea how to implement in compiler and vm since the extra arguments must be discarded. Example: from types import Variadic
test = Variadic fn(arguments)
print(arguments)
end
test(1)
test(1, 2, 3)
class Foo is Variadic
def _init
self.msg = "hello"
end
def _test1(arguments)
print(self.msg, "test1", arguments)
end
def _test2(arguments)
print(self.msg, "test2", arguments)
end
end
f = Foo()
f.test1(1)
f.test2(1, 2, 3) Output:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Native function can have variadic parameters by using pkGetArgc.
But it seems no way to have this ability it in script. Am I wrong?
The text was updated successfully, but these errors were encountered: