-
Notifications
You must be signed in to change notification settings - Fork 165
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 DeclareGlobalName
; together with BindGlobal
it can be used to replace uses of DeclareGlobalVariable
& InstallValue
(which are not thread safe and have other dangers)
#3858
Conversation
So, my only thought is that unlike the old DeclareGlobalVariable / InstallName, we don't "check" the two are in sync, so I can do This can't be fixed without introducing something like We might decide this isn't a significant concern, but I just wanted to mention it. |
If that happens, then one of these happens:
So all in all, it seems there is not much we loose there? |
9a97ce8
to
4aae2c9
Compare
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'm happy with this. I'm going to give it another few days for anyone who wants to comment on design / names.
But this still lacks documentation... |
b140284
to
348814b
Compare
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 think the setup is fine. I’d perhaps prefer just DeclareGlobal
, but as you say - bikeshedding, and DeclareGlobalName
is totally clear and appropriate.
Would approve with doc.
348814b
to
79e1f41
Compare
I like the idea. 👍 |
a9c3a19
to
6b61da9
Compare
@@ -180,8 +180,7 @@ DeclareGlobalFunction( "CharValueSymmetric" ); | |||
## </Description> | |||
## </ManSection> | |||
## | |||
DeclareGlobalVariable( "CharTableSymmetric", | |||
"generic character table of symmetric groups" ); | |||
DeclareGlobalName( "CharTableSymmetric" ); |
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.
Note that the second argument to DeclareGlobalVariable
always was ignored, so it's safe to discard it here and elsewhere.
I've now added some documentation, so this could potentially be merged, after a fresh round of reviews. |
Note that I only added docs for |
I've updated and slightly tweaked the documentation of |
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.
one tiny comment
8f15105
to
df3ca3a
Compare
@ssiccha thanks! I've now squashed this, split the commit differently, and edited the documentation further. Please have a look again. |
I split the actual changes which replace uses of I should note that one could (should?) also treat most uses of And once this release in GAP 4.12, we could of course start changing packages to use this, but I expect this to be a slow process |
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, apart from the typo.
With DeclareGlobalName one can mark the name of a global variable as "will be defined". The only effect this has is that it suppresses "Unbound Global Variable" warnings. This can be used in many cases to replace uses of `DeclareGlobalVariable` & `InstallValue` respectively `DeclareGlobalFunction` & `InstallGlobalFunction` by `DeclareGlobalName` & `BindGlobal`. Co-authored-by: Sergio Siccha <sergio.siccha@gmail.com>
df3ca3a
to
5eabdf1
Compare
@ChrisJefferson OK to approve/merge? |
Yes, I'm happy. Thanks all! |
InstallValue
DeclareGlobalName
; together with BindGlobal
it can be used to replace uses of DeclareGlobalVariable
& InstallValue
(which are not thread safe and have other dangers)
With DeclareGlobalName one can mark the name of a global variable as "will be defined". The only effect this has is that it suppresses "Unbound Global Variable" warnings.
This can be used in many cases to replace uses of
DeclareGlobalVariable
&InstallValue
respectivelyDeclareGlobalFunction
&InstallGlobalFunction
byDeclareGlobalName
&BindGlobal
.This PR complements PR #3857.
TODO:
DeclareGlobalName
(didn't want to spend work on that before I had any feedback on this design)DeclareGlobalName
?DeclareName
?DeclareGlobal
? Something else?