Tcl Library Source Code

View Ticket
Login
Ticket UUID: 333ccac763a25b85c68b0a0ad6864fa51db74fc6
Title: huddle wrap no longer accepts 2 arguments
Type: Bug Version: huddle 0.2+
Submitter: ethanp Created on: 2018-12-06 19:04:34
Subsystem: huddle Assigned To:
Priority: 5 Medium Severity: Important
Status: Open Last Modified: 2018-12-06 19:17:07
Resolution: None Closed By: nobody
    Closed on:
Description:
Starting in huddle v0.2 the "huddle wrap" command was changed to only accept one argument instead of the two it required in v0.1.  Since huddle 0.2 was noted as a bug-fix this lack of backwards compatibility was not expected.

The current docs still show the two argument form so either the docs need to be updated or the code should be updated to support two arguments.  

Here is a fix that supports both forms: 
proc ::huddle::wrap { args } {
    set num [llength $args]
    if { $num == 1 } {
      return [list HUDDLE [lindex $args 0]]
    } elseif { $num == 2 } { 
      return [list HUDDLE $args]
    } else {
      error "huddle wrap expects 1 or 2 arguments"
    }
}
User Comments: ethanp added on 2018-12-06 19:17:07:
To fully reproduce the huddle v0.1 behavior, the fix should be:
proc ::huddle::wrap { args } {
    set num [llength $args]
    if {$num == 1} {
      return [list HUDDLE [lindex $args 0]]
    } elseif {$num == 2} { 
      # Below behavior is from huddle::wrap v0.1
      if {[lindex $args 0] ne ""} {
        return [list HUDDLE $args]
      } else {
        return [list HUDDLE [lindex $args 1]]
      }
    } else {
      error "huddle wrap expects 1 or 2 arguments"
    }
}