Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ee6ab741b1e001615999c7095379203272b11448
Ticket: c1281082718e963be1b5c30ad0be9e895d26b40e
Allow globs in trap patterns
User & Date: adrianmedranocalvo on 2016-07-13 07:49:14
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/plain"
  4. comment changed to:
    At the moment "trap" clauses in the "try" command must exactly match the -errorcode prefix.  It would be useful being able to specify glob patterns for each of the -errorcode words.
    
    For example, given two TclOO subclasses implementing an interface (e.g. they share the superclass), we might want to prefix all -errorcodes with the class name similarly to how Tcl core prefixes all its errors with TCL.  Trapping an error from either subclass can be done at the moment as follows:
    
    try {
        $a feed $x;
    } trap {::cow BADFOOD} {} - trap {::human BADFOOD} {} {
        $a drink;
    }
    
    This becomes an issue when when adding a new ::animal subclass ::fly: the code above must be changed to take it into account.
    
    If globbing were allowed in trap patterns, the same could be accomplished as follows:
    
    try {
        $a feed $x;
    } trap {* BADFOOD} {} {
        $a drink
    }
    
    This new behaviour could be specified via a flag similar to switch's -glob and -regexp.
    
  5. foundin changed to: "8.6"
  6. is_private changed to: "0"
  7. login: "adrianmedranocalvo"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "7e3820ed81064cf9306d34dd9be1633e66f1a08b"
  10. resolution changed to: "None"
  11. severity changed to: "Minor"
  12. status changed to: "Open"
  13. submitter changed to: "adrianmedranocalvo"
  14. subsystem changed to: "None"
  15. title changed to: "Allow globs in trap patterns"
  16. type changed to: "RFE"