Comments on your Survey paper

Bill Janssen (janssen@parc.xerox.com)
Fri, 15 Oct 1993 16:53:39 PDT

[ Just to admit my biases: I've hacked GNU Emacs on both
the C and Elisp level; I've hacked ELK quite a bit, turning
it into a real shell, as well as embedding it in some
languages; I've dabbled in both Perl and Tcl; but Python is
currently my preferred language. It does pretty much everything
all these other languages do!

When I look at an interpreted extension language, I look for the
following (in no particular order):

1) object system
2) byte compiler
3) regular syntax
4) garbage collector
6) floating point support
7) macros
8) regular expression support
9) unix system call support
10) portability (UNIX, Mac, MS-Windows)
11) good file system support
12) reasonable image size
13) threads

because I know that sooner or later, I'll need them all. ]

OK, comments:

Page 6: You say that you're working on extracting the elisp
interpreter. I'd say, don't bother. ELK has already done a great
job, with the following advantages over elisp: 1) a standard language,
with books available, and 2) dynamic loading of new object code.

Page 6: Note that all the advantages you ascribe to Perl are also
in Python, except that Python tends to do it better!

Page 7: There are better FTP sites in the US for Python:
gatekeeper.dec.com 16.1.0.2 /pub/plan/python/cwi
ftp.uu.net 192.48.96.9 /languages/python
wuarchive.wustl.edu 128.252.135.4 /pub

Check out lib/python/ftplib.py.

Page 14: In addition to STDWIN, Python can manipulate X via Motif,
and of course it can do the same kind of things that you mention under
the Perl section. I am using it with EZD, Joel Bartlett's very nice
WAFE-style system (very nice, check it out!).

Page 18: Check out Python's regsub module. It arguably gives you all
the string replace power of Emacs. Basically the same as Tcl's, I
believe.

Page 19: Python's process control is at least as strong as Perl's.
In addition, it supports threads (!), so that some of the operations
you have to do in another process, using Tcl or Perl, you can do
in another thread, in Python.

Page 21: List directories:

#!/usr/bin/python
import posix
print len(posix.listdir('.'))

None of your hello world examples actually work on the Macintosh,
do they? This one (in Python) does (as well as X windows):

Hello, World:

#!/usr/bin/python
import stdwin
stdwin.message('Hello, World!')

Hello, Bob (I think; I didn't actually try it):

#!/usr/bin/python

def sub_in_file(file):
import regsub
import string

seen = None
fp = open(file, 'r+')
lines = fp.readlines()
fp.seek(0, 0)
for line in lines:
if seen:
regsub.gsub('Hello Bob', 'Hi James', line)
else:
seen = (string.find (line, 'Hello Bob') >= 0)
fp.write(line)

import sys

sub_in_file(sys.argv[1])

Page 27: The documents EMBEDDING and EXTENDING (in the src/misc
directory, which I agree is misleading) describe both how to add new C
primitives to Python, and how to embed it as the extension language
for some larger program.

Page 28: Note that there is a GNU Emacs mode for Python, as well as a
special subprocess mode for it. There are a couple of debuggers
shipped with the Python library, one windowing and one
command-line-like.

Page 30: See my comment on page 27. Note that unlike Perl, new Python
modules written in C can be dynamically loaded into a running
interpreter. You don't need to relink the image. Adding a new
datatype is very easy. Modifying the syntax ("adding a new keyword")
doesn't seem very easy. There could be a macro package...

Bill