-
-
Notifications
You must be signed in to change notification settings - Fork 192
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 other Julia compilation flags #62
Add other Julia compilation flags #62
Conversation
@SimonDanisch @NHDaly |
I'm interested in the use case for disabling/enabling |
arg_type = String | ||
metavar = "{yes|no}" | ||
range_tester = (x -> x ∈ ("yes", "no")) | ||
help = "load ~/.juliarc.jl" |
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.
From the arg name, "--startup-file"
, I would assume that this flag allows me to set a custom startup file. Is that desirable? I would either consider changing the behavior to what I just described, or changing the name of the variable to something like --use-startupfile
?
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.
As explained below, juliac
provides same compilation flags as julia
(in future julia-compile
). See julia -h
.
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.
okay i'm convinced. :) thanks!
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.
(sorry i misunderstood that what you were doing in this PR is just copying forward all of the julia flags! Makes sense.)
src/static_julia.jl
Outdated
) | ||
# TODO: these may just be temporary workarounds, see: https://github.com/JuliaLang/PackageCompiler.jl/issues/47 |
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.
"these" is unprecise. How about:
# TODO: precompiled and compilecache may be removed, pending: https://github.com/JuliaLang/PackageCompiler.jl/issues/47
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.
Ok I'll change that.
src/static_julia.jl
Outdated
) | ||
# TODO: these may just be temporary workarounds, see: https://github.com/JuliaLang/PackageCompiler.jl/issues/47 | ||
precompiled == nothing && cpu_target == nothing || (precompiled = "no") | ||
compilecache == nothing && (compilecache = "no") |
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.
hmm, i could be misunderstanding, but the first one doesn't feel correct to me.
If the user passes precompiled = "yes"
, won't this set precompiled to "no"?
I think maybe you want parentheses around the second two phrases?
precompiled == nothing && (cpu_target == nothing || (precompiled = "no"))
But honestly that's still hard to parse. perhaps this can simply be an if
-statement? I think this is what you meant?:
if (precompiled == nothing && cpu_target != nothing) precompiled = "no" end
# or this:
(precompiled == nothing && cpu_target != nothing) && (precompiled = "no")
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.
In Julia (like in Bash) &&
is passed through only if the previous expression returns true
, while ||
is passed through only if the previous expression returns false
. So if precompiled = "yes"
, then precompiled == nothing
returns false
, and therefore &&
is not passed through.
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.
:) So I think everything you just said is correct, and yet, behold:
julia> false && true || println("HI")
HI
I think the nuance is here:
while
||
is passed through only if the previous expression returnsfalse
.
In this case, the previous expression is actually the truth-value on the left-hand side of the ||. I would imagine it like this:
`precompiled == nothing` --> <evaluate expression ... okay, it's false!> --> `false` --> `&& (cpu_target == nothing)` --> <okay, skip the right-hand side, cause this already evaluates to false --> `false` --> `|| (precompiled = "no")` --> <now we need to evaluate the right-hand side again because the left-hand side was false, so the truthiness of the whole expression depends on the right-hand side> --> (precompiled = "no") --> <returns `nothing`>.
That's why I suggested, if you want to keep it exactly as you currently have it, you need to put parens around the entire right-hand side of &&
, so that it can skip the whole thing:
julia> false && (true || println("hello?"))
>> false
But i still think an if
-statement might be better, since, clearly, multiple short-circuiting statements can be confusing and hard to read. :)
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.
(In bash as well):
$ false && true || echo "HI"
HI
$ false && (true || echo "helloooooooooo")
$
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're perfectly right of course :) it's due to the precedence of &&
over ||
, I'll fix that, thanks!
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 is pretty straightforward:
precompiled == nothing && cpu_target != nothing && (precompiled = "no")
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.
👍 Otherwise, this looks good to me!
We are still in an early stage of development of Static Julia, there are still doubts for instance whether disabling
I agree that in future, once everything is clarified, we could add explanations in the docstring, but for now I thought to leave |
280d36c
to
5db0587
Compare
Codecov Report
@@ Coverage Diff @@
## master #62 +/- ##
=========================================
- Coverage 69.83% 69.53% -0.3%
=========================================
Files 5 5
Lines 295 302 +7
=========================================
+ Hits 206 210 +4
- Misses 89 92 +3
Continue to review full report at Codecov.
|
5db0587
to
8c72883
Compare
👍👍👍
…On Sat, May 12, 2018, 9:30 AM Luca Trevisani ***@***.***> wrote:
Merged #62 <#62>.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#62 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABgkEawhY0ZHizacMDyELmmgKMf270LKks5txvH6gaJpZM4T6gpy>
.
|
* Revert "remove github documenter workflow" This reverts commit dacb45b00005325fc5a04efa62a7646e3bc2c054. * do not run documenter on travis * pretty urls
No description provided.