I would like to define the macro const var"@lvec" = const var"@turbo @." if Julia is started with optimization levels 2 or 3, and const var"@lvec" = const var"@." otherwise.
My main motivation is that I use @tturbo @. very often. However, sometimes it fails to throw an error if the dimensions of the involved arrays are not consistent, whereas @. does not fail. So, I would like to define a single macro that is either any of them depending on the optimization level.
I am facing two problems:
- I do not know what command I should use to get the current optimization level – I need this to define an
ifsentence. - If I type
const var"@lvec" = var"@."in the REPL, I get the error`@.` not defined, something that does not happen, e.g., if I typeconst var"@lvec" = var"@warn".
Any help will be appreciated.