diff --git a/tconfpy.3 b/tconfpy.3 index 9fe9d7b..9c49659 100644 --- a/tconfpy.3 +++ b/tconfpy.3 @@ -424,45 +424,6 @@ validation but failed it for \'Min\'. -.SS Some Notes On Boolean Variables - -One last note here concerns Boolean variables. Booleans are actually -stored in the symbol table as the Python values, True or False. -However, \*(TC accepts user statements that set the value of the -boolean in a number of formats: - -.nf - -Boolean True Boolean False ------------- ------------- - -foo = 1 foo = 0 -foo = True foo = False -foo = Yes foo = No -foo = On foo = Off - -.fi - -This is the one case where \*(TC is insensitive to case - -"tRUE", "TRUE", and "true" are all accepted, for example. - -.B NOTE HOWEVER: -If the user wants to do a conditional test on the value of -a boolean they -.B must -observe case and test for either \'True\' or \'False\': - -.nf - - .if [boolvar] != False # This works fine - - .if [boolvar] != FALSE # This does not work - Case is not being observed - - .if [boolvar] != Off # Neither does this - Only True and False can be tested - -.fi - - .SS The Initial Symbol Table And Lexical Namespaces The @@ -828,7 +789,9 @@ .IP \(bu 4 Case is always significant except when assigning a value to Booleans -(described in the previous section). +(described in the section below entitled, +.B Some Notes On Boolean Variables +). .IP \(bu 4 Regardless of a variable's type, all variable references @@ -1055,7 +1018,11 @@ .fi This is illegal because whitespace is not permitted in variable names. -\*(TC will produce an error if it sees such a construct. +\*(TC will produce an error if it sees such a construct. As a general +matter, any variable you construct through this indirection method +must still conform to all the rules of variable naming: It cannot +contain whitespace, begin with \'$\', contain \'#\', \'[\', or \']\' and +so on. Get into the habit of reading \'[something]\' as, "The current value of \'something\'". See if you understand what the following does (if @@ -1238,17 +1205,12 @@ \'something\' and has nothing whatsoever to do with lexical namespaces. -This all works, by the way, because \'NAMESPACE\' is -nothing more than (yet) another variable in the symbol table. \*(TC -just understands that variable to be special - it treats it as the -repository of the current lexical namespace. - - .IP \(bu 4 Whichever method you use to change it, -.B the new namespace cannot begin with \'$\'. -Both of the following will cause an error: +.B the new namespace must follow all the same rules used for naming variables. + +For example, both of the following will cause an error: .nf [$FOO] @@ -1312,6 +1274,43 @@ .B The Initial Symbol Table And Lexical Namespaces for details.) +.IP \(bu 4 +Lexical namspaces are implemented by having \'NAMESPACE\' just be +nothing more than (yet) another variable in the symbol table. \*(TC +just understands that variable to be special - it treats it as the +repository of the current lexical namespace. This means you can use +the value of NAMESPACE in your own string substitutions: + +.nf + MyVar = [NAMESPACE]-Isn't This Cool? +.fi + +You can even use the current value of NAMESPACE when setting a new +namespace: + + +.nf + NAMESPACE = [NAMESPACE]-New +.fi + +One final, but very important point is worth noting here. The +\'NAMESPACE\' variable itself is always understood to be +.B relative to the root namespace. +No matter what the current namespace actually is, \'[NAMESPACE]\' or +\'NAMESPACE = ...\' always set a variable by that name in the +root namespace. Similarly, when we use a variable reference to get +the current namespace value (as we did in the example above), \'NAMESPACE\' +is understood to be relative to the root namespace. That's why things +like this work: + +.nf + [MyNewSpace] + x = 100 # MyNewSpace.x = 100 + y = [NAMESPACE]-1 # MyNewSpace.y = MyNewSpace-1 + + NAMESPACE = NewSpace # .NAMESPACE = NewSpace +fi + .SS Pre-Defined Variables @@ -1323,6 +1322,46 @@ .SS Type And Value Enforcement +.SS Some Notes On Boolean Variables + +One last note here concerns Boolean variables. Booleans are actually +stored in the symbol table as the Python values, True or False. +However, \*(TC accepts user statements that set the value of the +boolean in a number of formats: + +.nf + +Boolean True Boolean False +------------ ------------- + +foo = 1 foo = 0 +foo = True foo = False +foo = Yes foo = No +foo = On foo = Off + +.fi + +This is the one case where \*(TC is insensitive to case - +"tRUE", "TRUE", and "true" are all accepted, for example. + +.B NOTE HOWEVER: +If the user wants to do a conditional test on the value of +a boolean they +.B must +observe case and test for either \'True\' or \'False\': + +.nf + boolvar = YES + + .if [boolvar] != False # This works fine + + .if [boolvar] != FALSE # This does not work - Case is not being observed + + .if [boolvar] != Off # Neither does this - Only True and False can be tested + +.fi + + .SH ADVANCED TOPICS .SS Guaranteeing A Correct Base Configuration