github.com/benhoyt/goawk@v1.8.1/testdata/gawk/delarpm2.awk (about)

     1  # From beebe@math.utah.edu  Sat May 17 21:31:27 2003
     2  # Return-Path: <beebe@math.utah.edu>
     3  # Received: from localhost (aahz [127.0.0.1])
     4  # 	by skeeve.com (8.12.5/8.12.5) with ESMTP id h4HIQmCw001380
     5  # 	for <arnold@localhost>; Sat, 17 May 2003 21:31:27 +0300
     6  # Received: from actcom.co.il [192.114.47.1]
     7  # 	by localhost with POP3 (fetchmail-5.9.0)
     8  # 	for arnold@localhost (single-drop); Sat, 17 May 2003 21:31:27 +0300 (IDT)
     9  # Received: by actcom.co.il (mbox arobbins)
    10  #  (with Cubic Circle's cucipop (v1.31 1998/05/13) Sat May 17 21:34:07 2003)
    11  # X-From_: beebe@sunshine.math.utah.edu Fri May 16 20:38:45 2003
    12  # Received: from smtp1.actcom.net.il by actcom.co.il  with ESMTP
    13  # 	(8.11.6/actcom-0.2) id h4GHcd226764 for <arobbins@actcom.co.il>;
    14  # 	Fri, 16 May 2003 20:38:40 +0300 (EET DST)  
    15  # 	(rfc931-sender: mail.actcom.co.il [192.114.47.13])
    16  # Received: from f7.net (consort.superb.net [209.61.216.22])
    17  # 	by smtp1.actcom.net.il (8.12.8/8.12.8) with ESMTP id h4GHgBc2023067
    18  # 	for <arobbins@actcom.co.il>; Fri, 16 May 2003 20:42:13 +0300
    19  # Received: from sunshine.math.utah.edu (sunshine.math.utah.edu [128.110.198.2])
    20  # 	by f7.net (8.11.7/8.11.6) with ESMTP id h4GHcbf09202
    21  # 	for <arnold@skeeve.com>; Fri, 16 May 2003 13:38:37 -0400
    22  # Received: from suncore.math.utah.edu (IDENT:r8KQWmkF4jVMLBhxpojXGNCAnBZB38ET@suncore.math.utah.edu [128.110.198.5])
    23  # 	by sunshine.math.utah.edu (8.9.3p2/8.9.3) with ESMTP id LAA09111;
    24  # 	Fri, 16 May 2003 11:38:34 -0600 (MDT)
    25  # Received: (from beebe@localhost)
    26  # 	by suncore.math.utah.edu (8.9.3p2/8.9.3) id LAA01743;
    27  # 	Fri, 16 May 2003 11:38:34 -0600 (MDT)
    28  # Date: Fri, 16 May 2003 11:38:34 -0600 (MDT)
    29  # From: "Nelson H. F. Beebe" <beebe@math.utah.edu>
    30  # To: "Arnold Robbins" <arnold@skeeve.com>
    31  # Cc: beebe@math.utah.edu
    32  # X-US-Mail: "Center for Scientific Computing, Department of Mathematics, 110
    33  #         LCB, University of Utah, 155 S 1400 E RM 233, Salt Lake City, UT
    34  #         84112-0090, USA"
    35  # X-Telephone: +1 801 581 5254
    36  # X-FAX: +1 801 585 1640, +1 801 581 4148
    37  # X-URL: http://www.math.utah.edu/~beebe
    38  # Subject: gawk-3.1.2[ab]: bug in delete
    39  # Message-ID: <CMM.0.92.0.1053106714.beebe@suncore.math.utah.edu>
    40  # 
    41  # I discovered yesterday that one of my tools got broken by the upgrade
    42  # to gawk-3.1.2a and gawk-3.1.2b.  For now, I've temporarily reset
    43  # /usr/local/bin/gawk on the Sun Solaris and Intel GNU/Linux systems
    44  # back to be gawk-3.1.2.
    45  # 
    46  # This morning, I isolated the problem to the following small test case:
    47  # 
    48  # 	% cat bug.awk
    49  	BEGIN {
    50  	    clear_array(table)
    51  	    foo(table)
    52  	    for (key in table)
    53  		print key, table[key]
    54  	    clear_array(table)
    55  	    exit(0)
    56  	}
    57  
    58  	function clear_array(array, key)
    59  	{
    60  	    for (key in array)
    61  		delete array[key]
    62  	}
    63  
    64  	function foo(a)
    65  	{
    66  	    a[1] = "one"
    67  	    a[2] = "two"
    68  	}
    69  # 
    70  # With nawk, mawk, and also gawk-3.1.2 or earlier, I get this:
    71  # 
    72  # 	% mawk -f bug.awk
    73  # 	1
    74  # 	2
    75  # 
    76  # However, with the two most recent gawk releases, I get:
    77  # 
    78  # 	% gawk-3.1.2b -f bug.awk
    79  # 	gawk-3.1.2b: bug.awk:12: fatal: delete: illegal use of variable `table' as
    80  # 	array
    81  # 
    82  # If the first clear_array() statement is commented out, it runs.
    83  # However, the problem is that in a large program, it may not be easy to
    84  # identify places where it is safe to invoke delete, so I believe the
    85  # old behavior is more desirable.
    86  # 
    87  # -------------------------------------------------------------------------------
    88  # - Nelson H. F. Beebe                    Tel: +1 801 581 5254                  -
    89  # - Center for Scientific Computing       FAX: +1 801 581 4148                  -
    90  # - University of Utah                    Internet e-mail: beebe@math.utah.edu  -
    91  # - Department of Mathematics, 110 LCB        beebe@acm.org  beebe@computer.org -
    92  # - 155 S 1400 E RM 233                       beebe@ieee.org                    -
    93  # - Salt Lake City, UT 84112-0090, USA    URL: http://www.math.utah.edu/~beebe  -
    94  # -------------------------------------------------------------------------------
    95  #