I would like you folks' comments on the possibility of porting
Perlmacs (an embedding of Perl in GNU Emacs) to XEmacs. This should
probably take the form of a DLL, but an option for pre-dump loading
would be desirable, too. Information about Perlmacs is at
http://www.perl.com/CPAN/authors/id/JTOBEY/.
Judging by a brief look at the XEmacs source, a Perl embedding will
not be too difficult, but before I decide whether to work on one, I
want to propose some extensions to the XEmacs API. Also, I would like
to guage the likelihood that Perl support would be accepted into the
standard distribution.
A perl-interpreter type and a perl-thing type can be lrecords. I
gather that lrecords consist essentially of an opaque pointer and a
pointer to a struct lrecord_implementation. Perlmacs uses something
similar, though not as well-developed.
However, Perlmacs' extensible type has two features which lrecords
appear to lack. One is polymorphism. Instead of a constant string
stored directly in the virtual table, it has a type_of method which
returns a Lisp_Object. This helps reduce the number of vtables needed
to distinguish among types of Perl things, because Perl data already
knows its type. I propose adding a type_of method and using it
whenever "name" is found to be null.
The other feature is a "call" method which is invoked when a Perl
coderef appears in the car of an evaluated list:
Lisp_Object (*call) P_ ((Lisp_Object self, int nargs, Lisp_Object *args));
This avoids some consing when importing Perl functions. For example,
instead of
(lambda (&rest args)
(apply 'perl-call #<perl-code 0x12345678> args))
you can have simply #<perl-code 0x12345678> in the function cell.
Finally, I am curious to know whether anyone has proposed making
XEmacs namespace-clean. This is important for programs that do
dynamic loading. Perl itself is namespace-clean, but it may load
modules that are not. At the moment, Perlmacs is not namespace-clean,
but it is a priority.
I ask these things because I am faced with an either-or choice. There
is little chance of FSF accepting the Perlmacs patch. Either I will
continue working on the Emacs-based Perlmacs, or I will abandon it for
XEmacs.
Thanks
-John