Perl's strength is text handling, in a way no other tool/toolkit has - so
much so, that for some tasks, people compare its speed to dedicated
tools such as grep.
It has pretty much complete, and built-in support for most well used Unix
system calls, so writing an entire web server in perl doesn't raise too
many eyebrows. It has fast,convenient support for complex data types.
Tcl is not expected to be used as a full-fledged development environment
in its own right - it's more like a glue language, which provides a very
simple command-arguments kind of structure. One important fact of this
structure is that a statement like "if {<condition>} {. ... }" is a
command "if" followed by two arguments, one of which is a condition, and
the other a block of code. You can override this procedure by your
own "if" procedure if you want. This, and the fact that everything in TCL
is represented as a string, makes it extremely easy to write a scripting
interface for your C application. If the bulk of the work is actually being
done inside C/C++, the prime example being the Tk extension, then Tcl is
a good choice. I have also used TCL in situations where I have to tie
several applications together - it is really simple to send strings over,
and have it execute in a remote space. It is also really easy to debug
such a setup.
But the moment you start writing complex scripts, you tend to get into
language idiosyncracies - you suddenly start worrying about when to
use eval and when not to, and when to use {} as opposed to "" - much more
so than in any other language.
Perl is somewhat more daunting to be used as an extension/embedding
language, but dazzles as a stand-alone tool.
Why would your application require *both* languages? Will your application
be written mostly in Perl/Tcl or will it have C/C++ primarily? If it is
the former, maybe you should do it all in Perl. If it is the latter (writing
your app in C/C++), you might find that integrating with Tcl is probably
easier.
Will you be doing UI work at all ? TCL and Tk and all the UI extensions
obviously work very well together, and would probably be your first choice.
There is no dearth of public domain extensions for either. Nor is there
any dearth of support over the net.
This thread keeps coming up every once in a while.
For a comparison of Tcl to other systems, read
http://www.mathematik.uni-ulm.de/sai/ss96/uxdb2/comparison.html
For comparing Perl to other languages, check
http://www.perl.com/perl/versus/
Finally, check out most succesful applications using Perl or TCL -
you'll get a feel for the appropriate mix of scripting vs. C/C++.
And now for a wrinkle. Have you considered Python? Why not? :)
(check www.python.org)
-Sriram
(sri...@tcs.com)
It really does go beyond text handling though. I find mathematics in perl
(even without use of overloadable operators) pretty snappy.
How about this $scalar example from perlsub(1):
sub cube_root {
my $arg = shift; # name doesn't matter
$arg **= 1/3;
return $arg;
}
>Perl is somewhat more daunting to be used as an extension/embedding
>language, but dazzles as a stand-alone tool.
I personally find h2xs and MakeMaker very spiffy extenders.
>Will you be doing UI work at all ? TCL and Tk and all the UI extensions
>obviously work very well together, and would probably be your first choice.
Or your first choice might be Perl/Tk - see any of the following resources for
more information:
news: comp.lang.perl.tk
mail list: p...@lists.stanford.edu
(subsciptions requests to: majo...@lists.stanford.edu)
hypermail archive: http://pubweb.bnl.gov/~ptk/
web FAQ: http://w4.lns.cornell.edu/~pvhp/ptk/ptkTOC.html
For the record: I do like wish-es protoyping environment, but I am growing
more accustomed to either 'perl -de 0' or tkpsh. (Like any of the infamous
computer holy wars arguments almost always boil down to familiarity.)
I retain a huge amount of gratitude, amazement, and happy memories w.r.t.
Tcl/Tk - the alternative of X programming in C or C++ (or Fortran :) was too
burdensome for me.
Peter Prymmer
pv...@lns62.lns.cornell.edu