Skip to content

deprecates c.enclosingTree-style APIs #3354

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
merged 1 commit into from
Jan 17, 2014

Conversation

xeno-by
Copy link
Contributor

@xeno-by xeno-by commented Jan 11, 2014

Existing enclosing tree macro APIs face both technical and philosophical problems.

On the one hand, it’s close to impossible to provide their robust
implementation within the current typer infrastructure. From the very
beginning, these APIs have been very experimental, and I was very much
hoping to tackle the underlying technical problems, but after a year and
a half I can say that it’s still outside our reach.

On the other hand, we’re gravitating towards increasingly more local macro
expansion, which is in direct contradiction with the existence of
c.enclosingTree APIs. Therefore, in order to be able to further evolve
macros, we need need additional freedom to reshape the enclosing tree APIs.

Therefore I suggest we deprecate the aforementioned APIs and start
preparing ourselves to removing them for good in 2.12.0.

I hope that existing macros that use these APIs can be reformulated in
terms of completely local expansion or be built on top of orthogonal
language features (existing ones or new ones, e.g. something like
https://groups.google.com/forum/#!topic/scala-debate/f4CLmYShX6Q).
Please share your use cases, and I will be glad to help!

We have at least the entire 2.12 development cycle ahead of us, so I’m
sure we’ll figure this out. Let’s shape robust and scalable reflection
API together!

@ghost ghost assigned retronym Jan 11, 2014
@xeno-by
Copy link
Contributor Author

xeno-by commented Jan 11, 2014

review @retronym

@xeno-by
Copy link
Contributor Author

xeno-by commented Jan 11, 2014

@adriaanm @retronym Please consider this for inclusion in 2.11.0-M8.

@xeno-by
Copy link
Contributor Author

xeno-by commented Jan 11, 2014

/** The type of compilation units.
* @see [[scala.reflect.macros.Enclosures]]
*/
@deprecated("c.enclosingTree-style APIs are now deprecated; consult the scaladoc for more information", "2.11.0")
Copy link
Member

Choose a reason for hiding this comment

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

This should be a link to the Scaladoc of Enclosures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea here was to both condense the deprecation message and safeguard ourselves against possible hyperlink changes. Maybe we could get away with the link to Enclosures being provided in the scaladocs of deprecated members instead?

Copy link
Member

Choose a reason for hiding this comment

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

Ideally we'd read the warnings from Scaladoc that tells you if a link target doesn't exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't @see [[scala.reflect.macros.Enclosures]] already a link to the corresponding scaladoc? Or you mean something else?

Copy link
Member

Choose a reason for hiding this comment

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

Oh sorry I'm misreading this. I thought I was reading the Scaladoc comment, not the deprecation comment.

@retronym
Copy link
Member

LGTM

Existing enclosing tree macro APIs face both technical and philosophical problems.

On the one hand, it’s close to impossible to provide their robust
implementation within the current typer infrastructure. From the very
beginning, these APIs have been very experimental, and I was very much
hoping to tackle the underlying technical problems, but after a year and
a half I can say that it’s still outside our reach.

On the other hand, we’re gravitating towards increasingly more local macro
expansion, which is in direct contradiction with the existence of
c.enclosingTree APIs. Therefore, in order to be able to further evolve
macros, we need need additional freedom to reshape the enclosing tree APIs.

Therefore I suggest we deprecate the aforementioned APIs and start
preparing ourselves to removing them for good in 2.12.0.

I hope that existing macros that use these APIs can be reformulated in
terms of completely local expansion or be built on top of orthogonal
language features (existing ones or new ones, e.g. something like
https://groups.google.com/forum/#!topic/scala-debate/f4CLmYShX6Q).
Please share your use cases, and I will be glad to help!

We have at least the entire 2.12 development cycle ahead of us, so I’m
sure we’ll figure this out. Let’s shape robust and scalable reflection
API together!
@xeno-by
Copy link
Contributor Author

xeno-by commented Jan 16, 2014

Rebased

@retronym
Copy link
Member

LGTM

@adriaanm
Copy link
Contributor

Good to merge as soon as https://scala-webapps.epfl.ch/jenkins/job/pr-scala-test/4722/console succeeds.
Due to the high load on jenkins, I've started a manual rebuild on just the job that had stalled.

@adriaanm
Copy link
Contributor

@xeno-by
Copy link
Contributor Author

xeno-by commented Jan 17, 2014

The build linked by Adriaan is green - it's just that the status update is stuck. Therefore I'm merging this pull request without waiting for the kitten to wake up.

xeno-by added a commit that referenced this pull request Jan 17, 2014
deprecates c.enclosingTree-style APIs
@xeno-by xeno-by merged commit a5b0fc4 into scala:master Jan 17, 2014
@xeno-by xeno-by deleted the topic/enclosing-xxx branch January 24, 2014 16:44
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.

4 participants