On Tue, 28 Jul 2015, EGarrulo wrote: > On Tuesday, July 28, 2015 at 2:54:50 PM UTC+2, Dmitry A. Kazakov wrote: > >> You can inline the suggested wrapper and hope that the compiler indeed does >> inlining than effectively will make it lazily evaluated. > > I can't understand what you mean here. Would you please explain > further? Thank you. I am not Dmitry, but here is what I frequently do (I actually have a package Debug for that). The declaration is as follows: procedure Trace(Do_It: Boolean; Message: String) with Inline; The implementation is procedure Trace(Do_It: Boolean; Message: String) is begin if Do_It then Ada.Text_IO.Put_Line(Trace_File, Message); end if; end Trace; In your program, you just write Me_Active: Constant Boolean := True; -- change this to False if you don't want to trace Me. Debug.Trace(Me_Active, "Performing Step " & Step(Me)); Now the compiler (well, gnat -- I have no clue what other compilers will do) will first inline the code inside Debug.Trace and, if Active_Me is False, and the function Step has no side effects, the compiler will eliminate the dead code -- at least, if you switch on the optimization. Actually, this is *not* lazy evaluation: If Step has side effects, Ada requires to evaluate it, even if Me_Active is False. A lazy language would not evaluate Step. But in the given case, who would want to call some function Step with side effects? -------- I love the taste of Cryptanalysis in the morning! -------- www.uni-weimar.de/de/medien/professuren/mediensicherheit/people/stefan-lucks ----Stefan.Lucks (at) uni-weimar.de, Bauhaus-Universität Weimar, Germany----