Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2001-04-05
07:18 • Closed ticket [218127ffff]: 'space commands' to solve major/minor pl... artifact: 54c7c7617b user: dgp
07:17 • Open ticket [218127ffff]. artifact: 4000995f70 user: dgp
2000-10-26
08:15 • Closed ticket [218127ffff]. artifact: 8291cbf80a user: welch
00:53 • New ticket [218127ffff]. artifact: 83d54d713f user: nobody

'space commands' to solve major/minor

Closed / Fixed218127ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 00:53:27
OriginalBugID: 1986 RFE
Version: 8.0.5
SubmitDate: '1999-05-04'
LastModified: '2000-01-12'
Severity: LOW
Status: Closed
Submitter: pat
ChangedBy: hobbs
OS: All
OSVersion: NA
Machine: NA
FixedDate: '2000-10-25'
FixedInVersion: NA
ClosedDate: '2000-01-12'


Name:  Alexandre FERRIEUX

DesiredBehavior:
    Idea: interpreting whitespace in a proc name as a subcommand override.
    
    Example:
    
    # Today we handle subcommands this way:
    proc a {sub args} {
    switch -- $sub {
     b {...}
     c {...}
     default {error "a: Unknown subcommand '$sub'"}
    }
    }
    
    # With 'space commands' we'd do instead:
    proc a {sub args} {error "a: Unknown subcommand '$sub'"}
    proc "a b" args {...}
    proc "a c" args {...}
    
    Detailed mechanism: when evaluating a command line "a b c d e", Tcl
    would first look for a proc named "a b c d e", then "a b c d", ..., then
    "a". Notice that this can be made fairly efficient, by using the base
    proc as an anchor (basename) where we'd store a linked list of special
    cases, ordered by decreasing length; e.g. if "a b c" and "a b c d e" are
    overridden, the structure linked with procedure "a" would contain the
    list {{4 "b c d e"} {2 "b c"}}. The comparisons with the actual
    parameter list could be done on strings, or lists, or hash values.
    Notice that for the 99% of procs with no subcommand override, this list
    would be empty, hence no performance drag.
    
    Benefit: this solves the major/minor way in a way that's very natural in
    Tcl.
    


While the concept of major/minor is important, this is an incompatible,
and somewhat odd was of achieving such behavior.  We'd rather explore
more natural command extension possibilities. 
-- 01/12/2000 hobbs
welch Closed ticket [218127ffff]. [History diff]2000-10-26 08:15:55
dgp Open ticket [218127ffff]. [History diff]2001-04-05 07:17:53
dgp Closed ticket [218127ffff]. [History diff]2001-04-05 07:18:50
Log in (anonymous is fine) to add a comment.