From: karl@NeoSoft.com (Karl Lehenbauer)
Subject: Re: tcl vs embedded perl
Organization: NeoSoft Communications Services -- (713) 684-5900
Distribution: all
Date: Sat, 11 Apr 1992 18:17:12 GMT
Summary: There's lots of string parsing, I/O to children... plus, reliability.

In article <BRANNON.92Apr11084320@stun4b.cs.caltech.edu> brannon@stun4b.cs.caltech.edu (Terrence M. Brannon) writes:
>	I didnt see many string parsing features in the documents I
>have looked over for tcl. Perhaps you dont do much string parsing?

Did you see the "string" command, which includes options to compare,
match, find the first occurrence of another string, the length, extract
a range, map to upper and lowercase and trim whitespace?

Plus there's the "regexp" command, which lets you match regular expressions
against a string, including assignment of matched subexpressions to
named variables and so forth.

Also check out the extensions provided by Extended Tcl, a set of upwardly
compatible extensions that Mark Diekhans (markd@grizzly.com) and I created.

Here is a rundown of some of the capabilities of Extended Tcl that are 
relevant to your query:

    cindex - Return the indexed character from the specified string.
    clength - Return the length of the specified string.
    crange - Return a range of characters from a string specifying start and
             end.
    csubstr - Return a range of character from a string specifying start and
              length.
    ctype - Determine if string has various characteristics.
    translit - Translate characters in a string like the "tr" command.

o File Scanning Commands
    scancontext - Manage file scan contexts.
    scanfile - Scan specified file against selected scan context.
    scanmatch - Specify Tcl code to execute when scan pattern matches.

List manipulation commands:
    intersect - Return the logical intersection of two lists.
    intersect3 - Return the intersection of two lists, with remainders.
    lempty - Determine if a list is empty.
    lrmdups - Sort a list and remove duplicate elements.
    lvarpop - Pop or replace the specified element from a list.
    union - Return the logical union of two lists.

o XPG/3 message catalog support.

>	How about filtering input and output to an inferior proocess?

Well, any file that you open in Tcl can be a pipeline to or from a command,
instead of a regular file.  Also, from Extended Tcl you can directly 
do fork, exec, pipe, dup, wait and friends, so you can cobble up your
own subprocesses.  Finally there's Don Libes' "expect" package, which
lets you manage pty sessions and such, with Tcl programmability.

Finally, Tcl and Extended Tcl include a suite of over 1400 tests which can
be run from a single command, to test all the commands and look for bugs.
Anytime John Ousterhout, Mark or I have found a bug in Tcl where it wasn't
detected by a test, we added a test to check for that bug.
Consequently, few bugs have been found in Tcl, and none that I know of have 
reappeared in subsequent releases.

Compare this to PERL, where, from my occasional monitoring of comp.lang.perl,
bugs often reappear in new releases, and all people have to test with are
a few simple confidence tests plus running whatever programs they happen to
use at their site.

Oh yeah, we can enable memory debugging options and, after completing a
session, get a list of the file names and line numbers of all allocation 
requests that didn't have corresponding frees, meaning that we have an
easy time finding and fixing memory leaks.

Ciao.
-- 
-- Email info@NeoSoft.com for info on getting Internet access.
     "Trust me.  I know what I'm doing." -- Sledge Hammer
Newsgroups: comp.lang.tcl