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
nativecall: Add language to address #2684 #2791
Conversation
The syntax for NativeCall callable signature constraints under Rakudo deviates from the usual syntax. There is an issue at rakudo/rakudo#2878 addressing this, but until this is addressed, some minimal explanation for the strange syntax is needed.
Please don’t merge this yet; it’s for discussion at #2684. |
@@ -653,9 +653,18 @@ say $esponja; | |||
|
|||
NativeCall also supports native functions that take functions as arguments. One | |||
example of this is using function pointers as callbacks in an event-driven | |||
system. When binding these functions via NativeCall, one need only provide the | |||
system. When binding these functions via NativeCall, one should need only provide the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need only provide is correct, should need only is not. should need to only provide could be an alternative.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
needs only provide, actually...
equivalent signature as L<a constraint on the code parameter|/type/Signature#Constraining_signatures_of_Callables>: | ||
|
||
# See below--this syntax does not work on Rakudo currently |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really see no point in including an example of something that does not work. We can mark an issue as "external" and wait for it to be solved instead.
# void SetCallback(int (*callback)(const char *)) | ||
my sub SetCallback(&callback:(Str --> int32)) is native('mylib') { * } | ||
|
||
However, in the case of NativeCall, currently Rakudo requires a space between the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, this kind of statement is impossible to maintain. Currently when? Up to when? We can leave the issue open if needed, but the documentation should reflect what's happening right now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, since there's no reaction to this and I don't like PRs to be sitting there for a long time, I'm going to merge and fix it afterwards. Thanks!
The syntax for NativeCall callable signature constraints under Rakudo
deviates from the usual syntax. There is an issue at
rakudo/rakudo#2878 addressing this, but until this is addressed, some
minimal explanation for the strange syntax is needed.