-
Notifications
You must be signed in to change notification settings - Fork 17
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
Add @__DIR_P__, @__FILE_P__ and @LOCAL macro #1
Conversation
I'd opt for just leaving them unexported for now and keeping the same names as base. Alternatively, I'd go with |
I'm not sure why you're pinging me, since I don't currently use this package or currently have any needs that are addressed by it. |
@vtjnash I'm pinging you because you added @rofinn I'll go with your new name recommendations, I like them! I do think exporting by default makes sense, after all the whole point of this is to have some short things. |
Codecov Report
@@ Coverage Diff @@
## master #1 +/- ##
==========================================
+ Coverage 82.51% 82.64% +0.12%
==========================================
Files 8 8
Lines 406 409 +3
==========================================
+ Hits 335 338 +3
Misses 71 71
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine apart from a 0.7 syntax issue. Now that I think about it, having just @__PATH__
/@__CWD__
and @__FILEPATH__
might be best, as @__FILEPATH__
could just default to the current file if one isn't specified?
src/path.jl
Outdated
if evaluated by julia -e <expr>. | ||
""" | ||
macro __PATH__() | ||
:(Path(@__DIR__()===nothing?Path():@__DIR__)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need spaces in the ternary for that to be valid syntax on 0.7.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Alright, I have stared at this for a minute, and I just don't understand what this sentence means :) Can you elaborate a bit what you are suggesting? |
Sorry, I was just suggesting that we have |
Ah :) Hm, I almost feel having three separate things is cleaner? I'm not too keen on the name I do wonder whether there is a better name for Or, here is another thought: if we used some operator for path concatenating (say function Base.:*(a::AbstractPath, b::AbstractPath)
return join(a,b)
end
function Base.:*(a::AbstractPath, b::AbstractString)
return join(a,Path(b))
end Then one could just write @__PATH__() * "foo" Which looks quite natural to me? |
I could see introducing @__PATH__() / "foo" or @__PATH__() ‖ "foo" The benefit is that it wouldn't be confused with string concatenation and both seem more correct for than |
How about I remove |
Sure, would you be okay with not exporting |
Alright, now |
CC @vtjnash
There are some open questions before we can merge this:
@__DIR_P__
and@__FILE_P__
, does anyone have a better idea?julia -e
? Right now it always returnsPath()
, but I'm not sure that is a good idea. Should we instead returnnothing
?