Function name conflict: ADL / function merging?

I agree that it wouldn’t be a type piracy issue if Julia let you define your own stack function in this way (which would be separate from the stack function exported by the dependent package), so then locally the identifier stack would point to your function rather than the existing one.

The trade-off is that if you actually did intend to extend the existing stack, things are broken in a subtle and confusing way. I don’t have any data on this, but my hunch is that extending functions is far more common than defining new functions with the same name as an existing one. I’m guessing this error is thrown to prevent that situation.

Note this is also an argument for using Foo: bar, baz to be explicit about what names you pull into your local namespace, so if you did want to define your own stack function, you wouldn’t using it.

1 Like