diff options
Diffstat (limited to 'doc/gawk.texi')
-rw-r--r-- | doc/gawk.texi | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/gawk.texi b/doc/gawk.texi index 4e1b2cb0..c7099447 100644 --- a/doc/gawk.texi +++ b/doc/gawk.texi @@ -21021,6 +21021,29 @@ function causes it to become a scalar variable (unassigned). However, @code{isarray()} and @code{typeof()} are different; they do not change their arguments from untyped to unassigned. +@cindex dark corner @subentry array elements created by reference +By ``variable'' we mean one denoted by a simple identifier. Array elements +that come into existence simply by referencing them +are different, they are automatically forced to be scalars. Consider: + +@example +$ @kbd{gawk 'BEGIN @{ print typeof(x) @}'} +@print{} untyped +$ @kbd{gawk 'BEGIN @{ print typeof(x["foo"]) @}'} +@print{} unassigned +@end example + +@noindent +@code{x[0]} comes into existence before it is passed to @code{typeof()}; +@code{typeof()} cannot tell that it didn't exist prior to being called. +@value{DARKCORNER} + +@c FIXME: For 5.2, this will change, update this bit of doc. +This may change in a future release, whereby @command{gawk} +would allow such an unassigned array element to be used for +a multidimensional array, and not remain a scalar forever +(or until deleted). + @node I18N Functions @subsection String-Translation Functions @cindex @command{gawk} @subentry string-translation functions |