Option to start REPL in baremodule mode

Just stumbled upon the type privacy issue, especially when wanting to overwrite Base.+ and other operators. As long as I working in modules we can use baremodule to easily switch between Base.+ and MyPackage.+. However in the julia REPL this seems impossible right now.

  • Is it possible to add a --baremodule flag (or something similar) to julia executable, which startsup the REPL as a baremodule where Base is not yet in using mode?

You don’t need baremodule.

julia> +(a, b) = 23
+ (generic function with 1 method)

julia> 1 + 2
23

julia> Base.:+(1, 2)
3
1 Like

thanks. Yeah that is true and is a workaround, however when calling

using MyPackageWithPlus

you will get the usual warning

WARNING: using MyPackageWithPlus.+ in module Main conflicts with an existing identifier.

and nothing is assigned. You have to assign functions yourself.

With a --baremodule flag everything would work.