Compiler API: Simplify #interactive

MD
Marcus Denker
Wed, Jun 22, 2022 7:53 AM

The compiler has a lot of odd features as we wanted to be 100% backward compatible.

One of them is the idea of the “interactive” state.

-> a compiler compiled with a requestor or without.
-> Interactive use needs a requestor
- to print error messages
- to lookup variables

The requestor can implement #interactive to return false. This is used to hook into error handling by implementing a fake requestor.
MethodChunkCompilerRequestor is an example of that.

But in addition, the compiler added “interactive” as local state of the compilation context: you could make the compiler without a requestor
Interactive, or turn off the compiler interactive even though the requestor was interactive.

This makes no sense (and I think does not even work).

This PR simplifies the idea of #isInteractive: if there is no requestor, we are not interactive.

This means we do not need the flag "interactive" on CompilationContext and can simplify.

For now we keep the feature that requestors can implement #interactive and return false, to support MethodChunkCompilerRequestor.

I think we should simplify that, too, but that is another step.

PR is here https://github.com/pharo-project/pharo/pull/11392

(And already merged)

Marcus
The compiler has a lot of odd features as we wanted to be 100% backward compatible. One of them is the idea of the “interactive” state. -> a compiler compiled with a requestor or without. -> Interactive use needs a requestor - to print error messages - to lookup variables The requestor can implement #interactive to return false. This is used to hook into error handling by implementing a fake requestor. MethodChunkCompilerRequestor is an example of that. But in addition, the compiler added “interactive” as local state of the compilation context: you could make the compiler without a requestor Interactive, or turn off the compiler interactive even though the requestor was interactive. This makes no sense (and I think does not even work). This PR simplifies the idea of #isInteractive: if there is no requestor, we are not interactive. This means we do not need the flag "interactive" on CompilationContext and can simplify. For now we keep the feature that requestors can implement #interactive and return false, to support MethodChunkCompilerRequestor. I think we should simplify that, too, but that is another step. PR is here https://github.com/pharo-project/pharo/pull/11392 (And already merged) Marcus