diff --git a/doc/ref/language.xml b/doc/ref/language.xml index 2b99badcac..9bdf5dc27f 100644 --- a/doc/ref/language.xml +++ b/doc/ref/language.xml @@ -583,8 +583,7 @@ Second, the variable names are passed as strings, rather than being written directly into the statements.

Note that the functions , -, , -and +, and , deal with the global namespace. @@ -717,19 +716,6 @@ currently bound. - - - - - -returns a string that can be used -as the name of a global variable that is not bound at the time when - is called. -The optional argument prefix can -specify a string with which the name of the global variable starts. - - - diff --git a/doc/ref/obsolete.xml b/doc/ref/obsolete.xml index 97d5637abc..b05c062771 100644 --- a/doc/ref/obsolete.xml +++ b/doc/ref/obsolete.xml @@ -195,6 +195,12 @@ deprecated in GAP 4.10 since it was unused and only available for coefficient lists. Note that MultRowVector was also renamed to MultVectorLeft. +TemporaryGlobalVarName +The function TemporaryGlobalVarName has been deprecated in GAP 4.11. +Code using it typically can be restructured to not need it, e.g. by +using . + + diff --git a/lib/global.gd b/lib/global.gd index 5602e482b6..b418060739 100644 --- a/lib/global.gd +++ b/lib/global.gd @@ -257,20 +257,3 @@ DeclareGlobalFunction("MakeConstantGlobal"); ## DeclareGlobalFunction("BindGlobal"); DeclareGlobalFunction("BindConstant"); - -############################################################################# -## -#F TemporaryGlobalVarName( [] ) name of an unbound global variable -## -## -## -## -## -## TemporaryGlobalVarName ( [prefix] ) returns a string that can be used -## as the name of a global variable that is not bound at the time when -## TemporaryGlobalVarName() is called. The optional argument prefix can -## specify a string with which the name of the global variable starts. -## -## -## -DeclareGlobalFunction("TemporaryGlobalVarName"); diff --git a/lib/global.gi b/lib/global.gi index 0441ab2261..6c30298146 100644 --- a/lib/global.gi +++ b/lib/global.gi @@ -275,36 +275,3 @@ InstallGlobalFunction( BindConstant, Info( InfoGlobal, 2, "BindConstant: called to set ", name, " to ", value); BIND_CONSTANT( name, value ); end); - -############################################################################# -## -#F TemporaryGlobalVarName( [] ) name of an unbound global variable -## -## TemporaryGlobalVarName ( [] ) returns a string that can be used -## as the name of a global variable that is not bound at the time when -## TemporaryGlobalVarName() is called. The optional argument prefix can -## specify a string with which the name of the global variable starts. -## - -InstallGlobalFunction( TemporaryGlobalVarName, - function( arg ) - local prefix, nr, gvar; - - if Length(arg) = 0 then - prefix := "TEMP"; - elif Length(arg) = 1 and IsString( arg[1] ) then - prefix := arg[1]; - CheckGlobalName( prefix ); - else - return Error( "usage: TemporaryGlobalVarName( [] )" ); - fi; - - nr := 0; - gvar:= prefix; - while ISBOUND_GLOBAL( gvar ) do - nr := nr + 1; - gvar := Concatenation( prefix, String(nr) ); - od; - - return gvar; -end ); diff --git a/lib/obsolete.gd b/lib/obsolete.gd index 323c2c09f0..d5dd576781 100644 --- a/lib/obsolete.gd +++ b/lib/obsolete.gd @@ -691,6 +691,24 @@ if GAPInfo.CommandLineOptions.D then InfoRead1 := Print; fi; if not IsBound(InfoRead1) then InfoRead1 := Ignore; fi; if not IsBound(InfoRead2) then InfoRead2 := Ignore; fi; +############################################################################# +## +#F TemporaryGlobalVarName( [] ) name of an unbound global variable +## +## +## +## +## +## TemporaryGlobalVarName ( [prefix] ) returns a string that can be used +## as the name of a global variable that is not bound at the time when +## TemporaryGlobalVarName() is called. The optional argument prefix can +## specify a string with which the name of the global variable starts. +## +## +## +## Still used in anupq, nq, resclasses, SCSCP (02/2019) +DeclareGlobalFunction("TemporaryGlobalVarName"); + ############################################################################# ## diff --git a/lib/obsolete.gi b/lib/obsolete.gi index fe53880c17..80386da904 100644 --- a/lib/obsolete.gi +++ b/lib/obsolete.gi @@ -959,6 +959,42 @@ BIND_GLOBAL( "SetFeatureObj", function ( obj, filter, val ) fi; end ); +############################################################################# +## +#F TemporaryGlobalVarName( [] ) name of an unbound global variable +## +## TemporaryGlobalVarName ( [] ) returns a string that can be used +## as the name of a global variable that is not bound at the time when +## TemporaryGlobalVarName() is called. The optional argument prefix can +## specify a string with which the name of the global variable starts. +## + +InstallGlobalFunction( TemporaryGlobalVarName, + function( arg ) + local prefix, nr, gvar; + + Info(InfoObsolete, 2, "This usage of `TemporaryGlobalVarName` is no longer ", + "supported and will be removed eventually." ); + + if Length(arg) = 0 then + prefix := "TEMP"; + elif Length(arg) = 1 and IsString( arg[1] ) then + prefix := arg[1]; + CheckGlobalName( prefix ); + else + return Error( "usage: TemporaryGlobalVarName( [] )" ); + fi; + + nr := 0; + gvar:= prefix; + while ISBOUND_GLOBAL( gvar ) do + nr := nr + 1; + gvar := Concatenation( prefix, String(nr) ); + od; + + return gvar; +end ); + if IsHPCGAP then BindThreadLocal("HIDDEN_GVARS",[]);