Skip to content
Tcl Source Code History Of Ticket 35fdc88036489d43
Login

History Of Ticket 35fdc88036489d43

Artifacts Associated With Ticket 35fdc88036489d43

  1. Ticket change [3383e3f7c9] (rid 151992) by mr_calvin on 2017-02-23 12:52:19:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      % proc foo {a a a} {return [concat [info local] $a]}; foo 1 2 3
      a a a 1
      
      To quote KBK from IRC yesterday :)
      
      "Arguably, that's a bug. It surely doesn't do anything useful, and we probably should detect it as an error."
      
      "The fact that Tcl has been around for 27 years, and nobody's noticed [proc x {a a a} { ... }] until now indicates that it's low-worry, especially if it doesn't cause a crash. (I expect that it'll just discard the first two args at run time.)"
      
      Low-worry, indeed, but potentially irritating ([info]) and kind of puzzling after so many years.
      
      In the attached patch, I gave it a shot. Tests were added to proc.test, two tests fixed in trace.test (actually using repeated names!). The above one liner will now result in a proper TCL_ERROR:
      
      arg list contains a duplicate entry "a"
      
      Stefan
      
    5. foundin initialized to: "8.7a0"
    6. is_private initialized to: "0"
    7. login: "mr_calvin"
    8. priority initialized to: "5 Medium"
    9. private_contact initialized to: "d4d1d8192a46acf2c7d58cddc1040ecdbc9c9d77"
    10. resolution initialized to: "None"
    11. severity initialized to: "Minor"
    12. status initialized to: "Open"
    13. submitter initialized to: "mr_calvin"
    14. subsystem initialized to: "22. [proc] and [uplevel]"
    15. title initialized to:
      proc: disallow duplicated parameter names in arg spec
      
    16. type initialized to: "Patch"
  2. Add attachment "dupes.patch" [2cd63a28ef] (rid 151993) by mr_calvin on 2017-02-23 12:53:27.

  3. Ticket change [7c6098ffd9] (rid 151994) by avl42 on 2017-02-23 13:15:12:

    1. icomment:
      Interestingly, while Tcl 8.6 was changed to disallow non-optional arguments following optional arguments, it didn't address non-unique names in the same wash.
      
      Btw., your expectation ("it'll just discard the first two args at run time") is not the right one, because instead it only uses the first one of the values.
      
    2. login: "avl42"
    3. mimetype: "text/plain"
    4. username: "It was noticed, but so far inertia won..."
  4. Ticket change [518729982c] (rid 151995) by mr_calvin on 2017-02-23 13:30:49:

    1. icomment:
      hi,
      
      As for "your expectation": This wasn't mine, but KBK's (is part of the quote).
      
      stefan
      
    2. login: "mr_calvin"
    3. mimetype: "text/plain"
  5. Ticket change [d5a8ed1172] (rid 151996) by dgp on 2017-02-23 16:04:16:

    1. icomment:
      
      
      FWIW....
      
      dgp	% info patch
      	7.5p1
      	% proc foo {a a a} {puts stderr [info local]-$a}; foo 1 2 3
      	a-3
      
      dgp	% info patch
      	8.0.3
      	% proc foo {a a a} {puts stderr [info local]-$a}; foo 1 2 3
      	a a a-1
      
      Also
      
      dah	% proc foo {a a a} {unset a; puts [info local]; puts $a}
      	% foo 1 2 3
      	a a
      	can't read "a": no such variable
      
      Seems to me Tcl 7 had the better idea of proper behavior.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  6. Ticket change [1e4155d8db] (rid 152742) by dgp on 2017-03-29 20:28:10:

    1. icomment:
      
      The contributed patch doesn't restore Tcl 7 handling.
      
      Instead it considers duplicate parameter names to be
      an error.
      
      Key trouble with this is:
      
      proc ::tk::EventMotifBindings {n1 dummy dummy} { ... }
      
      and
      
      proc ttk::entry::LineSelect {w _ _} {...}
      
      Since Tk breaks this proposed rule, it's a pretty safe
      bet other scripts and packages do as well.
      
      Given that, I'd consider this fix only for 8.7 and later,
      and might possibly consider it a Tcl 9 change.
      
      I'd like to see a patch bringing back Tcl 7 behavior to
      see how its different compat concerns would play out.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  7. Ticket change [64ed3aa380] (rid 152796) by dgp on 2017-04-03 18:27:42:

    1. icomment:
      
      The data structures at work here are deeply confused
      and convoluted, failing to distinguish between lists
      of argument names and lists of local variables.  They've
      been obfuscated and optimized to the point of
      incomprehensibility and interbred with unholy extensions
      like Itcl and tbcload.  It's unfixable. Only winning
      move is not to play.  Nuke it from orbit; only way
      to be sure.
      
    2. login: "dgp"
    3. mimetype: "text/plain"