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

Bare methods and bare lambdas (RFC 34) #1858

Merged
merged 1 commit into from
May 18, 2017
Merged

Conversation

Praetonus
Copy link
Member

These new language constructs can be used in FFI interoperation with C libraries that use function pointers as callbacks.

Closes #1690.

@Praetonus Praetonus added the changelog - added Automatically add "Added" CHANGELOG entry on merge label Apr 21, 2017
@SeanTAllen
Copy link
Member

SeanTAllen commented Apr 22, 2017

Before we merge this, I want to note the documentation and other "how we teach this changes" that we should have ready at the same time:

Bare lambdas should be mentioned and explained in the FFI section 
of the tutorial, since they are intended to be used with and only 
useful in the context of FFI.

Bare lambdas should be demonstrated and compiled in an example in 
the examples subdirectory of the ponyc repo, similar to the
 ffi-struct example.

}

member = ast_sibling(member);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't there only be a single member in a bare type - the bare method?

Under what circumstances might a bare type have any fields or non-bare methods?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is the constructor.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks. 👍

@Praetonus
Copy link
Member Author

I've added examples and opened a tutorial PR.

{
i = 1;
offset = 0;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI is complaining about this - either need to surround this block with #if PONY_LLVM >= 309, or add a (void)offset; statement to prevent compiler warnings/errors about this variable not being used when the PONY_LLVM >= 309 condition on the later line is not met.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

These new language constructs can be used in FFI interoperation with C
libraries that use function pointers as callbacks.

Closes ponylang#1690.
@jemc jemc merged commit 3a36c0d into ponylang:master May 18, 2017
ponylang-main added a commit that referenced this pull request May 18, 2017
@jemc
Copy link
Member

jemc commented May 18, 2017

Awesome work!

@Praetonus Praetonus deleted the bare-methods branch May 18, 2017 04:00
jemc added a commit that referenced this pull request Jun 3, 2017
This was broken as a side effect the placement of a check
introduced in #1858, and was fixed by just changing the order
of the checks so that we don't expect to be in a method body frame
if we are in a default argument frame.
SeanTAllen pushed a commit that referenced this pull request Jun 3, 2017
This was broken as a side effect the placement of a check
introduced in #1858, and was fixed by just changing the order
of the checks so that we don't expect to be in a method body frame
if we are in a default argument frame.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog - added Automatically add "Added" CHANGELOG entry on merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants