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

Decrease syntax cost of usage #5

Open
jrudolph opened this issue Sep 13, 2022 · 0 comments
Open

Decrease syntax cost of usage #5

jrudolph opened this issue Sep 13, 2022 · 0 comments

Comments

@jrudolph
Copy link

Hey, thanks for sharing this example here (and, of course, the original paper). I somehow missed it back at the time but recently found it. It seems somewhat similar in spirit to my speed project from 2014 built on Scala 2 macros (with a custom enhanced reify implementation), but without staging.

The staging approach is nice because it very explicitly moves the stream creation to compile time. I wonder, though, if this would be implemented for real there are some issues with using it:

  • user needs some understanding of staging
  • need two defs per stream (inline def + actual definition)
  • multiple file restriction for inline def usage
  • need to pass expressions for integer literals
  • lambdas require explicit Expr => Expr form ("manual beta reduction")

etc.

I wonder what would be needed to make this more convenient to use. The approach used in speed was to pattern match on a given stream expression to extract the structure of a stream. The staging approach seems nicer but introduces some ceremony. Is there a middle ground? Also how far could you get with just inlining and powerful constant propagation?

/cc @nicolasstucki

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

No branches or pull requests

1 participant