Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d3b69988d4736ce985dd1f0677c44e244f350758
Ticket: 1446696fffffffffffffffffffffffffffffffff
Tcl_ParseArgv as a useful non-Tk version of Tk_ParseArgv
User & Date: sbromle on 2006-06-19 02:59:34
Changes

  1. icomment:
    Logged In: YES 
    user_id=1472195
    
    Hi Stephen,
    Thanks for your reply. It looks like a lot of thought
    has been put into tclobjv.c, and perhaps it would make
    a better codebase to adopt into Tcl proper, tho I don't
    yet really have the Tcl experience to judge. :)
    
    If you would indulge me a little further, I'd like to raise
    a few more questions with you. In my use of tclArgv.c, we've
    implemented many commands, I guess effectively creating
    somewhat of a domain specific language. A typical command
    actually performs many functions and so we've found that our
    commands often have tens of options. Remembering them all
    is hard without an automatically generated help. Basically I
    feel that the existing GetIndexFromObj suffices for typical
    C-implemented Tcl commands, and in this context, an
    automaticly generated help is extraneous. However, I figure
    that if you need the extra complexity of tclArgv for your
    command parsing, then you'd probably want the automatically
    generated help. Being able to add descriptions to each
    option is then a real benefit. Would you consider adding the
    ability to attach descriptions to each of your options and
    arguments? (I really like the way you handle the arguments
    as well, as currenly, tclArgv does not generate automatic
    help for the arguments, but strapping this onto tclobjv
    could be a nice way to go.)
    
    Requiring a specific order for arguments (that is, coming
    before all options) is probably a good idea for consistency.
    Sure tclArgv doesn't care, but any user could get used to it.
    
    In one sense I like that your unknown arguments trigger an
    error. On the other hand, this prevents you from calling a
    nested command with the same objv[]. Doing this kind of
    thing is probably not very common outside of X application
    programming, so I'm sure we need not worry about it.
    
    I like that you already have a complete set of tests
    available. It is also good that you use Tcl_GetIndexFromObj.
    
    Aestetically (which means a trivial change only is required)
    I would like to see a version that removes all the "Ns"
    prepending so that it looks more core-Tcl-ish. (Yeah, this
    point is obvious. :) )
    
    W.r.t. to Don's suggestions for tclArgv, I've made the
    following changes:
    (i) Removed TCL_DONT_SKIP_FIRST_ARG.
    (ii) TCL_ARGV_NO_ABBREV -> TCL_EXACT
    (iii) Added a &remObjv argument to collect unprocessed
    arguments, and thus also eliminating the
    TCL_ARGV_NO_LEFTOVERS flag.
    (iv) I disagree with ditching the -help option, for the
    reason I cited above regarding the developer/user already
    choosing the greater complexity of tclArgv over a
    Tcl_GetIndexFromObjv-only solution.
    
    I'm still continuing work on it. I haven't yet re-cast
    Tcl_ParseArgv as a thin wrapper around Tcl_ParseObjArgv,
    nor added the missing data types. I'll do my best to submit
    a patch with all the changes soon.
    
    Meanwhile, if Stephen could provide me with a little package
    that allowed me to use his version as a little shared
    library, with the modification to provide dynamic help, I'll
    merge it in with my application and give it a test drive to
    see what the users think.
    
    I look forward to hearing any suggestions from anyone
    regarding the suitability (or lack-thereof) of the two
    options (TclArgv and tclobjv).
    
    Cheers,
    Sam. 
    
    
  2. login: "sbromle"
  3. mimetype: "text/plain"
  4. username: "sbromle"