Skip to content
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

Merged
merged 1 commit into from Jul 21, 2019
Merged

Conversation

treyharris
Copy link
Contributor

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.

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.
@treyharris
Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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.

Copy link
Contributor

@JJ JJ left a 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!

@JJ JJ merged commit f8c1778 into master Jul 21, 2019
JJ added a commit that referenced this pull request Jul 21, 2019
@coke coke deleted the nativecall-constraint-syntax branch March 5, 2023 20:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants