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

Consider not using Mirrors for derivation, so that multi-level hierarchies can be suppored #310

Open
adamw opened this issue Jun 10, 2021 · 4 comments
Labels

Comments

@adamw
Copy link
Member

adamw commented Jun 10, 2021

Mirrors give us a lot "for free", but I think we could do just as well without them (that is, give the same user experience & performance), while additionally supporting multi-level hierarchies

@adamw adamw added the scala3 label Jun 10, 2021
@adamw adamw changed the title Consider not using Mirrors for derivation, so that multi-level hierarchies can be supportd Consider not using Mirrors for derivation, so that multi-level hierarchies can be suppored Jun 10, 2021
@KacperFKorban
Copy link
Collaborator

I agree. I've been thinking about rewriting most of the derivation logic to macros for a while.

But when it comes to ditching Mirrors altogether, there is IMHO a problem with accessing subtypes of a trait. (And that is mostly why I haven't mentioned it before) But there is also a chance that I missed something.

There is also this docs page. It still uses Mirrors, but on a bit lower level. Maybe it would work better?

@adamw
Copy link
Member Author

adamw commented Jun 10, 2021

But when it comes to ditching Mirrors altogether, there is IMHO a problem with accessing subtypes of a trait. (And that is mostly why I haven't mentioned it before) But there is also a chance that I missed something.

Of a non-sealed trait? I suppose for sealed traits / enums we can use Symbol.children?

If not, maybe indeed summoning mirrors and using this information level by level would work.

@KacperFKorban
Copy link
Collaborator

Ok, so that is the case. I just missed it... repeatedly... 🤦

So I think that it should be more or less straightforward then.

@ghostdogpr
Copy link

Btw hopefully Mirrors should support it soon: scala/scala3#11686

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