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

Investigate building a Scala 3 plugin #39

Open
cb372 opened this issue Nov 16, 2020 · 4 comments
Open

Investigate building a Scala 3 plugin #39

cb372 opened this issue Nov 16, 2020 · 4 comments
Labels

Comments

@cb372
Copy link
Owner

cb372 commented Nov 16, 2020

This issue is to investigate the feasibility of porting scala-typed-holes to Scala 3.

I haven't looked at all at how to write compiler plugins in Scala 3. I imagine the plugin architecture is roughly the same, although the AST and the compiler internals are different from Scala 2.

I don't think there's much chance of sharing any code between Scala 2 and Scala 3. I imagine it'll be separate branches, or maybe even separate repos.

@cb372 cb372 added the LSUG label Nov 16, 2020
@zainab-ali
Copy link

I'm working on an initial stab at this in https://github.com/zainab-ali/scala3-typed-holes. I also think the architecture should be roughly the same, and that the challenge will be in tree traversal.

The compiler phases have also changed. I have yet to figure out exactly which phases this runs between.

@cb372
Copy link
Owner Author

cb372 commented Nov 30, 2020

Great! Thank you for picking this up. Looking forward to seeing how you get on with it.

@zainab-ali
Copy link

It's going well so far 🎉
Finding the holes is straightforward.

Here's a working traversal for one binding:
https://github.com/zainab-ali/scala3-typed-holes/blob/main/root/test/resources/sample/expected.txt

The overall structure is a bit clunky (the traversal is split into a prepareFor and transform for pre and post steps. There might be an equivalent of a Traverser somewhere in the dotty codebase that I'm missing. A macro would possibly clean up the syntax.

I've yet to deeply immerse myself in Scala 3 - there may be even more opportunities for holes, and match types will have interesting bindings.

@Mercerenies
Copy link

Just here to chime in my support. I found this project just today and would love to see it migrated to Scala 3!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants