It seems like what I had to do to implement a new version of the "subst"
command was a hack.  The new command is "weld".  I would have preferred to
stick with standard JACL on this, but the results of the "time" command
justified the replacement:

    weld {242700 microseconds per iteration}
    subst {459500 microseconds per iteration}
    weld {243800 microseconds per iteration}
    subst {456400 microseconds per iteration}
    weld {242600 microseconds per iteration}
    subst {454600 microseconds per iteration}

Each timing ran in sequence to eliminate any variances due to
initialization.  The input for each iterated 10 times, and the original
script started as 2810 "source" bytes and resulted as 6369 bytes after
substitutions.  The "weld" command is identical to subst in function, but
eliminates the options and uses StringBuffer.append() to accumulate the
result instead of String concatenation.

At first, I thought I could just write the new command in my own package.
Since Interpret.evalFlags and Parser are only package accessible, I then
thought that I could just relocate the command in tcl.lang and make WeldCmd
public so that I could use Interp.createCommand to load it.  This caused
IllegalAccessException at runtime.

I didn't want to build a new, non-standard JACL that included the command,
so I changed the access back to package and tried using
Extension.loadOnDemand() - which worked.

Is this technique correct, or am I trying to do something that violates the
design philosophy?  Recommendations would be appreciated.

    - Lee




*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*=+=*
"You see, at just the right time, when we were still powerless,
     Christ died for the ungodly." - Romans 5:6

----------------------------------------------------------------
The TclJava mailing list is sponsored by Scriptics Corporation.
To subscribe:    send mail to [EMAIL PROTECTED]  
                 with the word SUBSCRIBE as the subject.
To unsubscribe:  send mail to [EMAIL PROTECTED] 
                 with the word UNSUBSCRIBE as the subject.
To send to the list, send email to '[EMAIL PROTECTED]'. 
An archive is available at http://www.mail-archive.com/tcljava@scriptics.com

Reply via email to