[GRASS-dev] Re: 'g.gui wxpython' won't work in wingrass as wxgui is a shell script

Glynn Clements glynn at gclements.plus.com
Wed Mar 19 22:36:05 EDT 2008


Ivan Shmakov wrote:

>  > IMHO, it's a pretty primitive and opaque programming language (e.g.,
>  > you have to use another scripting language like awk to do floating
>  > point math).
> 
> 	That's quite a frequent practice (consider, e. g., `expr' in
> 	Tcl, or Cpp for C.)  I don't think it should be afraid of.

At least Tcl's "expr" is actually part of the language. But Tcl isn't
a particularly good example here; very few languages have a separate
function for arithmetic.

>  > However, I think that it would benefit the community settle on a new
>  > scripting "standard" that is truly cross- platform and an easier,
>  > more up-to-date, powerful, and easier to use language. There are
>  > several good candidates for this, but Python has a number of
>  > pragmatic advantages in the current context.
> 
> 	Indeed, it may be a reasonable decision.  (Though it'd be
> 	interesting for me to know what are the particular problems with
> 	Tcl, which is both portable and was used in GRASS for quite some
> 	time?)

Tcl isn't much better than the Bourne shell as a language. The main
issue is its reliance upon textual substitution. Look at the number of
uses of "eval" and "subst" in e.g. gis.m; every one of those
demonstrates a deficiency in the language.

Textual substitution and "eval" make it easy to write code which only
"mostly" works, but falls down e.g. for values which contain syntactic
characters. E.g. it's common for code which deals with lists which
fails when list items contain spaces.

>  > What this means is that we need to have Python people volunteer to
>  > begin to rewrite existing Bash scripts in Python and begin writing
>  > any new scripts in that platform so that we can have the critical
>  > mass to encourage others to learn it and write in it. A couple people
>  > have started on this.
> 
> 	I'm afraid that an attempt to rewrite /all/ the Shell scripts in
> 	Python will both take time and bring some mess along.  Would
> 	you, e. g., consider an untested 100-lines Python substitute for
> 	a 50-lines Shell script (that's known to be working for years)
> 	to encourage anyone to write in Python?

The deficiences of the Bourne shell as a programming language are such
that I would tend to have more faith in a minimally-tested Python
re-write than in a shell script. Programs written in a real language
tend to either work or not work, while shell scripts tend to sort-of,
kind-of mostly work.

-- 
Glynn Clements <glynn at gclements.plus.com>


More information about the grass-dev mailing list