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

macros should only allow AbsTypeTag context bounds #6186

Closed
scabug opened this issue Aug 4, 2012 · 4 comments
Closed

macros should only allow AbsTypeTag context bounds #6186

scabug opened this issue Aug 4, 2012 · 4 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

@scabug scabug commented Aug 4, 2012

Back then, we had TypeTag (=AbsTypeTag now) and ConcreteTypeTag (=TypeTag now), and people used "TypeTag" context bounds everywhere (I guess that's because if everyone mentions "type tags", then your knee jerk reaction is to write TypeTag without even suspecting that there's ConcreteTypeTag). As a result, things like this could happen (and actually happened): #5884. So we decided to make concrete type tags the default choice to prevent confusion.

However for macros the situation is exactly the opposite. As you rightly mentioned, AbsTypeTags are most often the right choice. At first, I thought that this won't be a problem, because people who write macros will be more experienced than people who just want to migrate from manifests. However on a second thought I think we fall into the same problem - encouraging people to shoot off their feet (and the "more experienced" argument is just an excuse).

I think we should simply prohibit TypeTags in macro impl context bounds, leaving AbsTypeTag as the only supported bound. If a macro really-really needs concreteness guarantees (and, as your example above shows, that would be an exceptional case), then this verification can be easily performed inside the macro body.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Aug 4, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6186?orig=1
Reporter: @xeno-by
Other Milestones: 2.10.0

@scabug

This comment has been minimized.

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Aug 4, 2012

@xeno-by said:
"Something to consider as well is having Context.typeOf use AbsTypeTag"

@scabug

This comment has been minimized.

Copy link
Author

@scabug scabug commented Aug 7, 2012

@scabug scabug closed this Aug 7, 2012
@scabug scabug added this to the 2.10.0-M6 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.