[ale] Cutting up directory
Joseph A. Knapka
jknapka at earthlink.net
Tue Feb 13 12:06:47 EST 2001
Stephen Lastinger wrote:
>
> This is why I love this group. Very nice Joseph, I know that the text
> install for the RH distro's was written in tcl (or at least at one time
> it was), but until now had never seen tcl syntax.
>
> Not trying to start a flame war here, but would anyone care to comment on
> the virtues of their favorite (yes, perl included ; ), or on why they
> chose one over the other, or if proficient in more than one, which one
> fits best into what role and why?
>
> -Stephen
I like Tcl/Tk and Python a lot. You can get useful work done
with Bash scripts if you are desperate. I've written and maintained
just enough Perl code to know that I want to stay as far away from
it as possible :-)
Tcl/Tk pros: extremely simple, regular syntax. Extremely simple to
package code as data and pass it around. Tk makes building simple
GUIs almost trivial. (I have one application, a simulator for
multidrop serial devices, that reads a device description specifying
the simulated device's internal state, and then generates a
GUI on the fly. Took me about a day to write that.) It is extremely
easy to extend the Tcl language in either Tcl or C, and it is
extremely easy to embed a Tcl interpreter inside another app
to provide a read-made scripting language.
Tcl/Tk cons: lacks high-level structure (eg objects). Many built-in
functions expect to be able to work with global variables. (There
are extensions to add object orientation to Tcl, notably
[incr Tcl], and those work well, but add an additional deep
layer of complexity to the language). The way the Tcl interpreter
interprets code has a couple of subtle consequences that bite nearly
every Tcl programmer eventually. Complex Tcl code can look pretty
cryptic, although still not as cryptic as "Hello World" in Perl :-)
Python pros: has all the structuring tools you will need to produce
large applications; it's object-oriented from the ground floor.
Rumored to be as easy to extend as Tcl, though I've never written
a Python extension. Very nice-looking, easy-to-read, easy-to-maintain
code, once you get used to it. Python has an interface to Tk, which
in theory would make GUI-building nearly as easy as in Tcl. It takes
some effort to write truly incomprehensible Python code.
Python cons: The interface to Tk is almost totally undocumented
(last time I looked), so figuring out how it works is a challenge.
The Python interpreter cares deeply about the exact way the code
is laid out on the page - block structure is conveyed by
indentation; many people really hate that. Python is IMO a bit
more work to learn well than Tcl (I'm not sure I'd claim to
know Python "well" yet).
Sh/Bash pros: It's always there if you need it. You can learn
Bash scripting from the Bash man page in a pinch.
Sh/Bash cons: Nearly as cryptic as Perl. Many operations require
external processes to be invoked, so Bash scripts tend to be
a lot slower than equivalent Tcl or Python, in my experience.
Perl pros: cough. Umm, well, the regexp facilities are pretty
nice. And if you take over someone's WWW administration duties,
10 to 1 you'll have to maintain some Perl (not sure if that's
a pro or a con).
Perl cons: I think I better keep my mouth shut...
HTH,
-- Joe Knapka
--
To unsubscribe: mail majordomo at ale.org with "unsubscribe ale" in message body.
More information about the Ale
mailing list