Skip to content

Add draft as regression tests #14413

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

Merged

Conversation

nicolasstucki
Copy link
Contributor

Draft higher order quoted expressions.

Draft higher order quoted expressions.
@nicolasstucki nicolasstucki force-pushed the draft-higher-order-expressions branch from d957ec6 to ab81d47 Compare February 4, 2022 08:52
@nicolasstucki nicolasstucki self-assigned this Feb 4, 2022
@nicolasstucki nicolasstucki requested a review from smarter February 4, 2022 08:54
// Splicing can only be done on Expr[_ <: Any].
// `apply methods on higher order expression provide a way to replace the unbound variables.

// This can be used for HOAS quoted patterns to not return a lambda.
Copy link
Member

Choose a reason for hiding this comment

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

Add a link to https://en.wikipedia.org/wiki/Higher-order_abstract_syntax ? It helped me understand what was going on in this example :).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added the link to this paragraph in the GPCE paper. There might be some information that is also useful before that.

Screenshot 2022-02-04 at 16 46 41

// This can be used for HOAS quoted patterns to not return a lambda.
// The use would be the same as each higher order expression would have an apply method.
// But as it would be an expression, the expression would showable.
// The expression could also be directly transformed into a Term of the reflection API.
Copy link
Member

Choose a reason for hiding this comment

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

You mean, we could have a Term with holes? How would that work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not no holes in the sense of the Hole AST. It would contain references to unbound variables in the current scope. We should probably also have a way to list the symbols of those variables to be able to identify them when reflecting on the AST. I still need to figure out what is the best way to encode this internally.

Copy link
Member

Choose a reason for hiding this comment

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

It would contain references to unbound variables in the current scope.

So what can we do with such a term? I thought translating from an Expr to a Term should always produce a valid hygiienic tree.

@nicolasstucki nicolasstucki merged commit 0647084 into scala:main Feb 7, 2022
@nicolasstucki nicolasstucki deleted the draft-higher-order-expressions branch February 7, 2022 14:06
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.

2 participants