Skip to content

Add trace.force back #11181

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 2 commits into from
Jan 22, 2021
Merged

Add trace.force back #11181

merged 2 commits into from
Jan 22, 2021

Conversation

abgruszecki
Copy link
Contributor

No description provided.

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

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

I think having force is nice, but this PR can be simplified.

@@ -50,7 +62,7 @@ object trace:
printer: Printers.Printer = Printers.default,
showOp: Any => String = alwaysToString)
(op: => T)(using Context): T =
if ctx.mode.is(Mode.Printing) || (printer eq Printers.noPrinter) then op
if ctx.mode.is(Mode.Printing) || !doForceTrace && (printer eq Printers.noPrinter) then op
Copy link
Contributor

Choose a reason for hiding this comment

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

I am against having an override for printers. trace.force with default arguments gives you a printer anyway. If you want another printer, just enable it in Printers.scala. One way to do things.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think that printers are orthogonal to what trace.force is trying to enable.

What I really want to be able to do is to tell students "to see information about GADT constraints, force this trace". And "if you need even more information, force this one as well". If the students were required to also enable the corresponding printers, that wouldn't give them any useful information - in fact, it'd just drown them in irrelevant information from the typer printer.

So what I'm trying to illustrate with that example is that I want something which allows forcing a specific trace to be printed out without doing anything else, and that something is trace.force.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, I see the workflow better now. So the idea is that to enable a specific trace, you just replace the trace with trace.force. Makes sense.

@abgruszecki abgruszecki assigned odersky and unassigned nicolasstucki Jan 22, 2021
@abgruszecki abgruszecki removed the request for review from nicolasstucki January 22, 2021 10:00
@odersky odersky merged commit 6947b0f into scala:master Jan 22, 2021
@odersky odersky deleted the fix-trace-force branch January 22, 2021 19:05
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.

3 participants