nemerle
nemerle copied to clipboard
Don't optimize unused variables in Debug configuration
In the below program foo
is optimized away even in Debug-mode. For debugging purposes it would be useful to be able to inspect the values of unused local variables. As such they should not be optimized away in the Debug configuration.
using System.Console;
namespace Test
{
public module Main
{
public Main() : void
{
def foo = 42;
WriteLine("Whatever");
}
}
}
Use this trick:
def foo = 42;
WriteLine("Whatever");
_ = foo;
Thanks! I came up with Debug.WriteLine
, but using the underscore is certainly more elegant.