-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make include accept arbitrary number of string inputs #23428
Conversation
This method will make `include` support a call syntax like ```julia include(@__DIR__, "filename.jl") ``` which is simpler than ```julia include(joinpath(@__DIR__, "filename.jl")) ```
This seems like it could be confusing; I'd almost think that |
The inspiration came from The feedback the user would get upon trying to include multiple files would be immediate and rather easy to understand, and if the automatic joinpath makes it more likely that people will use it rather than chaining paths together with the multiplication operator I say it's worth the potential confusion opportunity. It would be documented of course so that all confusion goes away upon reading |
Once upon a time, for a brief while, that's actually what it did: #19909. I have to say, this behavior makes more sense to me as a convenience, but the fact that there's two things it could mean makes me think it might be better to just require using |
However, I have to say, this is a much more useful behavior for multi-arg |
Is this a bit of a slippery slope? Should all functions that take a path have a vararg joinpath version? |
Welcome, @baggepinnen ! Thanks for the PR. I have to say I don't really like this though; I'd prefer to keep |
I would personally like for consistent acceptance of multiple strings with automatic |
JuliaLang/Juleps#26 maybe. |
That seems like a very promising idea, especially because the simple creation of the |
In my experience this is the kind of thing that gives a bit of convenience in the short term, but pain in the long term as new cases are encountered. If a function accepts a path, it should just accept the path as one argument, and how you get the path is an orthogonal concern. That's the only thing guaranteed to work in all cases. |
An example where multiple strings can be passed for convenience is |
I suspect that @JeffBezanson doesn't care for that either. |
I just see a lot of potential for confusion in this case. For example, With |
This method will make
include
support a call syntax likewhich is simpler than
This is my first PR to julia, I apologize in advance for any breach of protocol.