You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is neither documented nor convenient, and we can't ask users to enable it for bugs they struggle minimizing. We should probably add a -Ylog: setting.
The text was updated successfully, but these errors were encountered:
@Blaisorblade
There are two ways I can think of doing this:
Keep Printers an object, and turn every printer field (currently a val) into a def with an implicit Context argument (so we can access the new YlogPrinter flag (Ylog is already taken)).
Turn Printers into a trait and move it inside the cake for Context. This is more efficient because the printer fields can remain as vals, but maybe cakes are no longer hip?
I think a hard requirement is that this feature should not introduce any overhead when no printer is enabled. So two things to keep in mind:
Testing a setting's value is slow. Ideally it should be done only once (not each time you log something)
Context is the most allocated object in the compiler, so it should be kept small. That's why we have stuff like ContextBase. So you should not mix Printers with Context but with ContextBase
There is already a -Ylog option that will print stuff without having to touch the Printers. IIUC the distinction between the two is intentional (for performance reason?), and the Printers logs are meant to be a debugging tool for compiler writers, no something that we want to exposed under a flag.
Currently, enabling a logger requires modifying https://github.com/lampepfl/dotty/blob/61cba970fec1017223ceb37da05f241f011c14d4/compiler/src/dotty/tools/dotc/config/Printers.scala, replacing say
val exhaustivity: Printer = noPrinter
withval exhaustivity: Printer = default
.This is neither documented nor convenient, and we can't ask users to enable it for bugs they struggle minimizing. We should probably add a
-Ylog:
setting.The text was updated successfully, but these errors were encountered: