[Oberon] Conditional compilation using IF const THEN

Jörg joerg.straube at iaeth.ch
Sun Aug 12 15:39:59 CEST 2018

    >> Why not do it? During test phase "debug = TRUE". For customer shipment
    >> "debug = FALSE"
    >> So, it's not really a different code I ship to customers and debug.
    >Yes it is, if the debug code is optimised out!
Of course, you're right, puristically speaking.
If I only put calls to module "Out" in my IF const THEN END, then the code that is optimized out does not change the logic of my code.
This is what I meant by "not really different": not binary the same, but logically the same.

    >But to take Andreas' example of using module Out for this, just replace
    >the (dynamically-loaded) Out module with a stub version in production.

For the special case of debugging output, your proposed
    IMPORT Out := OutStub;
would be indeed an alternative. With this, your productive binary still includes all the debug code and strings.


More information about the Oberon mailing list