Is it possible to import everything but?

Both PlutoUI and Makie export Slider. It seems like the right type name for each, but causes naming conflics in notebooks. One then has to qualify the usage by PlutoUI.Slider. Is it possible to import everything but Slider from Makie? Something like using Makie: -Slider

Yes you can do:

using Makie: Slider as MSlider

as described here:
https://docs.julialang.org/en/v1/manual/modules/#Renaming-with-as

This way you avoid the name clash and can use the Makie Slider as MSlider.

16 Likes

Awesome. I did not know this!

2 Likes

It’s also worth noting that you can do, even on old version of julia:

using Makie
using PlutoUI

const Slider = Pluto.Slider
const MSlider = Makie.Slider

Further you can, if the arguments don’t over-lap do manual method merging.
For example, lets say only if the first argument is a Figure should it use the Makie one.

using Makie
using PlutoUI

Slider(f::Figure, args...; args...) = Makie.Slider(f, args...; kwargs...)
Slider(args...; args...) = PlutoUI.Slider(f, args...; kwargs...)
11 Likes

I have a macro (the package UsingMerge) which automates this process

2 Likes