> 1) Is there a way to disable assertions in julia (like an optimize option)?

There is the @inbounds macro which disables bounds checking for built-in
arrays.

For your own code you could have an assertion function which you would
set to the identity function when running optimised and to checking for
non-optimised runs.

> 2) Something I like to do in C/C++ is have a macro to print a message which 
> includes the file and the line number where the macro was called via the 
> variables __FILE__ and __LINE__. I can then smatter print statements 
> throughout the code while debugging and I don't have to manually enter a 
> unique message for every line. 
>     If it doesn't exist, could something like that be added? It would also 
> be useful if such a print statement could be disabled in optimization mode 
> (perhaps a predefined variable can record whether the debug or the 
> optimization mode is being used?)

There is the @show macro which prints the variable and its value:
http://docs.julialang.org/en/latest/stdlib/base/?highlight=closure#Base.@show
But it does not show line numbers.  Not sure how you can get at those.
But you could definitely start with @show and modify it to your needs.
Then, for optimised code you can just re-define your show macro to do
nothing.  See:
https://groups.google.com/d/msg/julia-users/_ykG5e5WVbI/FwRpR6ov1a8J

Reply via email to