-
Notifications
You must be signed in to change notification settings - Fork 163
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
Added IsLIBGAP constant #2528
Added IsLIBGAP constant #2528
Conversation
lib/init.g
Outdated
SESSION(); | ||
else | ||
BIND_GLOBAL( "IsLIBGAP", true ); |
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.
Let's use BIND_CONSTANT
instead
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.
Looks good to me, but let's wait to see if tests pass.
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.
LGTM
lib/init.g
Outdated
@@ -1019,8 +1019,11 @@ end ); | |||
if IsHPCGAP and THREAD_UI() then | |||
ReadLib("hpc/consoleui.g"); | |||
MULTI_SESSION(); | |||
else | |||
elif not IsBound( IsLIBGAP ) or IsLIBGAP = false then | |||
BIND_CONSTANT( "IsLIBGAP", false ); |
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.
Test fail, partially because of your .tst file... e.g. in HPC-GAP, we will not define IsLIBGAP
. Better is to do this before line 1019:
if not IsBound(IsLIBGAP) then
BIND_CONSTANT( "IsLIBGAP", false );
fi;
and then change this check here back to elif not IsLIBGAP
, and drop the else
part.
## | ||
gap> START_TEST("IsLIBGAP.tst"); | ||
gap> IsBound( IsLIBGAP ); | ||
true |
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 may want to run ./gap tst/testinstall.g
before submitting an updated version of this PR, to make sure it really works.
Codecov Report
@@ Coverage Diff @@
## master #2528 +/- ##
=======================================
Coverage 74.4% 74.4%
=======================================
Files 481 481
Lines 243488 243488
=======================================
Hits 181157 181157
Misses 62331 62331
|
I updated the PR. I now initialize the |
lib/init.g
Outdated
|
||
############################################################################# | ||
## | ||
## Initialize the IsLIBGAP variable (if not done before). If this variable is false, an interactive |
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.
Please line-wrap this (I think at 78 chars... anyway, at the same width as the ####...
line above.
lib/init.g
Outdated
@@ -936,7 +947,6 @@ end ); | |||
#T as system variables! | |||
## | |||
|
|||
|
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.
Please don't remove this line.
ec2adae
to
6619d52
Compare
lib/init.g
Outdated
## Initialize the IsLIBGAP variable (if not done before). If this variable | ||
## is false, an interactive session will be started. | ||
## Otherwise no interactive session is started. | ||
## This should be done before the system GVAR list is created. |
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.
Change "should" -> "must" Or rather, just drop that line?
Anyway, let's not worry about this and merge as-is; I only mention it in case we need to update this again, say due to a build issue.
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.
"Should" is the right word here. It works if you do it afterwards (however that should be done), but it will not be marked as a system gvar.
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.
My point is more like this: There are countless variables which "should" or "must" be system vars, and none of them has a comment like this. It feels odd to point this out for just this variable. While I understand that this was a stumbling block during development of this PR, I don't quite see what it adds -- OK, hypothetically it might stop somebody from "moving" it around, but then, why would somebody do that? OTOH, if I just want to understand what it is, then reading this adds cognitive burden.
That said, I am not going to get stuck on that -- I merely point it out.
lib/init.g
Outdated
MULTI_SESSION(); | ||
fi; | ||
elif IsLIBGAP = false then | ||
BIND_CONSTANT( "IsLIBGAP", false ); |
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.
Actually, this call to BIND_CONSTANT
is redundant, isn't it? After all, you just checked that value.
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.
It was supposed to make IsLIBGAP
constant, which does not work in this case anyway, so I will remove it.
lib/init.g
Outdated
@@ -1018,8 +1030,11 @@ end ); | |||
|
|||
if IsHPCGAP and THREAD_UI() then | |||
ReadLib("hpc/consoleui.g"); | |||
MULTI_SESSION(); | |||
else | |||
if IsLIBGAP = false then |
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 was confused by the new logic for a moment (sorry for missing it in the previous version)... How about this
if IsLIBGAP then
# GAP is used as a library, so don't start a session
elif IsHPCGAP and THREAD_UI() then
MULTI_SESSION();
else
SESSION();
fi;
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.
I am not sure actually. If we ever decide to have a HPC-GAP libGAP, the way it is now we could leave this as it is.
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.
On the other hand, nevermind. I will change it to do have this logic.
6619d52
to
863c24b
Compare
This constant can be set to true in the initialize_libgap function (future work) to stop GAP from starting an interactive session
863c24b
to
b99b8ed
Compare
I removed the questionable sentence :). |
This constant can be set to true in the initialize_libgap function (future work)
to stop GAP from starting an interactive session
This replaces #2527