[Radiance-general] RADIANCE and Unix shells

Randolph Fritz randolph at panix.com
Fri Sep 30 02:29:05 CEST 2005


"It is possible [to do almost anything in any language].  However, just
because one can get a pea up a mountain by pushing it with one's nose does
not mean that is the best way of getting it there!"--(I forget who)

One can do shell-like scripting in most languages these days.  Language
preferences divide sharply, and often people simply prefer the language
they have learned first.  On the commercial side, language choices are
often made for non-technical reasons, and there is something to be said
for using languages best fitted to a platform; if one is integrating
Radiance with AutoCAD, there is much to be said for AutoLISP or even (woe)
Visual Basic.

That said, I will offer these opinions:

1. Generally, Python is widely accepted as a simple, object-oriented
interpretive language that can be used for serious applications work. 
Ruby, though less widely used, is also considered good for such jobs. 
Perl can be used in this way, but one must be disciplined in its use, or
it will have the problems of a shell.

2. The heavy use of textual substitution as a programming technique in
traditional shells (sh, ksh, bash, csh, and so on) makes for large scripts
that are difficult to read and maintain--there is a particular problem
with file names that contain punctuation or spaces; if one makes extensive
use of variable substitution in Perl one has the same problems.  And,
distressingly, no-one actually knows what languages the traditional shells
accept, not even the people who maintain them; one is often forced to rely
on testing to determine the results of a particular incantation and there
is no guarantee one will see consistent behavior across platforms.

3. There are a number of useful but less popular languages with devoted
followings: the "rc" shell and LISP itself, the grandad of all
programmerly interpretive languages, come to mind.  However, if one wants
tools to be accessible to the widest developer community, it is probably
best to stick with more widely accepted tools.  There are oddities, too:
one could, for instance, use the web server language PHP, but I cannot see
a good reason to do so.

4. While it is possible to do shell-like tasks in compiled languages like
C, the debugging and maintenance effort is such that it is probably not
usually worth the trouble.  Microsoft's much-promoted C# has some of the
same problems.

5. Java.  Well, it can do the job.  But it seems to me to combine some of
the difficulties of programming in a compiled language (a persnicketty
typing system and a relatively long learning curve) with the difficulties
of interpretation (slowness).  The sheer amount of study (not to mention
the cost of texts) required to learn the Java class libraries is daunting.
 Still, it is pervasive, so maybe there is a role for it.

Lots of choices.  Personally, I'd recommend Perl, Python, or Ruby as one
is most comfortable.  If one doesn't already know a shell well, I'd say
that Python is the easiest to learn, and is most satisfying to a beginner
because of it, but one can get good results using any of those languages. 
Greg uses csh, and it's worth knowing it just to read existing Radiance
scripts, but of the shells it is the most cranky, and I wouldn't advise
starting there.  It helps to know a bit of Unix to get the best use out of
any shell, even if one is programming for Windows; I still recommend the
old CACM Unix article as a worthy reference.

Hope this helps!

Randolph




More information about the Radiance-general mailing list