Skip to content
Tcl Source Code History Of Ticket 1649062
Login

History Of Ticket 1649062

Artifacts Associated With Ticket 1649062

  1. Ticket change [359c59c1f3] (rid 106969) by boakley on 2007-01-31 17:39:54:

    1. assignee initialized to: "dkf"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      It appears that in 8.4.14 (I don't know about earlier versions...) "return -code error -errorcode xxx" doesn't work. The proper behavior (IMO) is seen in 8.5a4 FWIW. It is the "-errorcode xxx" part that doesn't seem to work.
      
      I expect to get the same results whether I use "return -code error" or "error" but I get different results on 8.4.14 with the following code (on Windows XP):
      
      proc main {} {
          foo return
          foo error
      }
      
      proc foo {what} {
          set ::errorCode NULL
          set ::errorInfo ""
          if {[catch {
              if {$what == "error"} {
                  error \
                      "error reported via error" \
                      "custom errorInfo" \
                      [list CUSTOM errorCode]
      
              } else {
                  return \
                      -code error \
                      -errorinfo "custom errorInfo" \
                      -errorcode [list CUSTOM  errorCode] \
                      "error reported via return"
              }
          } err]} {
              puts $err:
              puts "  errorCode: $::errorCode"
              puts "  errorInfo: $::errorInfo"
              puts ""
          }
      }
      main
      exit 0
      
      Here is what I get with 8.4.14:
      
      error reported via error:
        errorCode: CUSTOM errorCode
        errorInfo: custom errorInfo
      
      error reported via return:
        errorCode: NULL
        errorInfo: 
      
      This is what I get with 8.5a4:
      
      error reported via error:
        errorCode: CUSTOM errorCode
        errorInfo: custom errorInfo
      
      error reported via return:
        errorCode: CUSTOM errorCode
        errorInfo: custom errorInfo
      
      
      
    4. foundin initialized to: "obsolete: 8.4.14"
    5. is_private initialized to: "0"
    6. priority initialized to: "5 Medium"
    7. resolution initialized to: "None"
    8. status initialized to: "Open"
    9. submitter initialized to: "boakley"
    10. subsystem initialized to: "18. Commands M-Z"
    11. title initialized to:
      return -code error -errorcode xxx doesn't seem to work right
      
    12. type initialized to: "Bug"
  2. Add attachment "legacy.patch" [66778ca391] (rid 102719) by dgp on 2007-02-02 00:08:39.

  3. Ticket change [dc2b8f3d19] (rid 108093) by dgp on 2007-02-02 00:08:39:

    1. icomment:
      
      
      File Added - 214051: legacy.patch
      
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      The attached patch for
      the Tcl HEAD corrects
      the incompatiblity in
      maintenance of the legacy
      variables ::errorCode and
      ::errorInfo that is
      demonstrated in the report.
      
      I don't really like the
      patch much, since it adds
      a flag bit to iPtr->flags.
      In 8.5 I've been trying to
      remove such things, not add
      them.
      
      But, if this incompat is
      important, I suppose a flag
      to get this legacy support
      right isn't too bad.
      
      File Added: legacy.patch
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  4. Ticket change [605be7c9a5] (rid 115986) by dgp on 2007-02-02 00:09:56:

    1. assignee changed to: "dgp"
    2. foundin changed to: "obsolete: 8.5a6"
    3. title changed to: "incompat in ::errorInfo/::errorCode maintenance"
  5. Ticket change [741c592de4] (rid 105151) by dgp on 2007-06-06 00:33:23:

    1. icomment:
      
      
      File Added - 231848: 1649062.patch
      
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      patch updated to HEAD
      File Added: 1649062.patch
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"
  6. Add attachment "1649062.patch" [0ac8348ae2] (rid 113882) by dgp on 2007-06-06 00:33:23.

  7. Ticket change [548f3644ba] (rid 93968) by dgp on 2007-06-06 00:57:18:

    1. closedate changed to: "2007-06-05T17:57:18"
    2. closer changed to: "dgp"
    3. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      committed that patch plus a test
      and ChangeLog entry.
      
      
    4. login: "dgp"
    5. mimetype: "text/plain"
    6. resolution changed to: "Fixed"
    7. status changed to: "Closed"
    8. username: "dgp"
  8. Ticket change [5ac7b13d6a] (rid 118203) by jenglish on 2007-06-07 04:24:17:

    1. icomment:
      Logged In: YES 
      user_id=68433
      Originator: NO
      
      As I understand the initial report, 8.5a4 was doing the _expected_ thing, and 8.4.14's behaviour could be considered a bug.  (FWIW, I agree - although the precise timing of when ::errorCode and ::errorInfo get set doesn't appear to be specified in the manpages, so either way would be reasonable,  8.5's behaviour (without the patch) seems more intuitive to me.)
      
      Is this a matter of bugwards-compatibility?
      
      
    2. login: "jenglish"
    3. mimetype: "text/plain"
    4. username: "jenglish"
  9. Ticket change [1d1a8a574c] (rid 90734) by dgp on 2007-06-09 10:59:52:

    1. icomment:
      Logged In: YES 
      user_id=80530
      Originator: NO
      
      
      I like to think that in Tcl 8.5, the variables
      ::errorInfo and ::errorCode themselves have
      become legacy features.  And for legacy features
      we might as well keep as full legacy compat as
      we reasonably can.
      
      Since [catch] is extended to capture a
      dictionary of return options, there's
      no need to read post-catch info from
      ::errorInfo or ::errorCode; the same info
      is better retrieved from the return
      options dictionary.
      
      Similarly, since [interp bgerror] permits
      registration of a background error handler
      that gets passed the full return options
      dictionary, there's no need for such a
      handler to access such global variables any
      longer either.
      
      So, in my mind, the "right" way for scripts
      written for Tcl 8.5 to use the ::errorInfo
      and ::errorCode variables is not to use them.
      
      This means, that for me the best support
      for scripts that do use those variables is
      to maintain script-apparent consistency with
      how they worked in 8.4.  Some patchwork,
      like this one, I don't really like much,
      and probably would not have done, except
      someone actually did notice the difference.
      
      I figure if someone noticed enough to log
      a report, someone else probably has scripts
      that depend on the difference 
      and will suffer if we don't restore compat.
      
      Other similar examples are 1397843 and 1693252.
      
      I'd be happier if scripts did not exist
      that relied on such subtleties of the
      former implementation of maintenance
      of the ::errorCode and ::errorInfo
      variables, but exist they do, and
      keeping compat with their needs is easily
      enough done.
      
      
      
      
    2. login: "dgp"
    3. mimetype: "text/plain"
    4. username: "dgp"