Skip to content
Tcl Source Code View Ticket
Login

View Ticket

empty named array support

Closed / Invalid217827ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:44:24
OriginalBugID: 1532 RFE
Version: 8.0.5
SubmitDate: '1999-03-18'
LastModified: '1999-04-05'
Severity: MED
Status: Closed
Submitter: welch
ChangedBy: stanton
RelatedBugIDs: 977
OS: Linux-Red Hat
OSVersion: 5.2
Machine: Other
FixedDate: '2000-10-25'
ClosedDate: '1999-04-05'


Name:

Jean-Luc Fontaine



Extensions:

BLT-2.4, Tktable-2.4, stooop-3.7, scwoop-2.6, tkpiechart-5.2.2



CustomShell:

see above



DesiredBehavior:

    This patch for tcl8.0.5 make the following code possible: 

    

    set ($this,m) x

    puts $(this,m) ;# instead of $className::($this,m)

    thus making the stooop OO extension much less verbose when accessing

    class data members, and much faster too! 

    

    This also adds some consistency to the core: 

    

    namespace a {

      variable {}

    }

    set a::(x) 0

    puts $a::(x)  ;# works with current tcl version

    namespace a {

      set (x) 0

      puts $(x) ;# should work as line above

    }

    







Patch:

*** generic/tclCompile.c.origWed Mar 17 21:49:18 1999

--- generic/tclCompile.cWed Mar 17 21:49:31 1999

***************

*** 3152,3158 ****

                  c = *src;

              }

  }

! if (src == name) {

      /*

       * A '$' by itself, not a name reference. Push a "$" string.

       */

--- 3152,3158 ----

                  c = *src;

              }

  }

!   if ((src == name) && (*src != '(')) {

      /*

       * A '$' by itself, not a name reference. Push a "$" string.

       */

*** generic/tclParse.c.origWed Mar 17 21:49:25 1999

--- generic/tclParse.cWed Mar 17 21:49:31 1999

***************

*** 813,819 ****

  string++;

      }

  }

! if (string == name1) {

      if (termPtr != 0) {

  *termPtr = string;

      }

--- 813,819 ----

  string++;

      }

  }

!         if ((string == name1) && (*string != '(')) {

      if (termPtr != 0) {

  *termPtr = string;

      }

*** tests/parse.test.origWed Mar 17 21:55:46 1999

--- tests/parse.testWed Mar 17 21:56:54 1999

***************

*** 181,189 ****

      set b

  } {a$!}

  test parse-5.12 {array variable substitution} {

!     set b a$()

!     set b

! } {a$()}

  catch {unset a}

  test parse-5.13 {array variable substitution} {

      catch {unset a}

--- 181,188 ----

      set b

  } {a$!}

  test parse-5.12 {array variable substitution} {

!     list [catch {set b a$()} msg] $msg

! } {1 {can't read "()": no such variable}}

  catch {unset a}

  test parse-5.13 {array variable substitution} {

      catch {unset a}









PatchFiles:

    generic/tclCompile.c

    generic/tclParse.c

    tests/parse.test
welch Closed ticket [217827ffff]. [History diff]2000-10-26 07:59:45
dgp Ticket [217827ffff]: 3 changes [History diff]2001-04-13 23:15:12
Log in (anonymous is fine) to add a comment.