"Stephen J. Turnbull" <turnbull(a)sk.tsukuba.ac.jp> wrote:
>>>>> "John" == John Tobey <jtobey(a)channel1.com> writes:
John> I personally will be happy if all Perl support goes through
John> funcall.
This would be rather slow for typical Perl-ish direct buffer
manipulations, I should think.
Understood. In cases where speed is essential, one should avoid too
much jumping between languages. The value of Perl support, at first,
will have more to do with providing an alternative for people who do
not know Lisp and providing access to the Perl module library.
John> Maybe things like car and cdr can avoid it for
John> speed, but that will happen in a Perl module (Emacs::Lisp)
John> and will not touch the xemacs binary.
??? Why would Perl code go ripping into list structure? It was in a
different context, but you did write "I want Perl to chew on the text
in my buffer".
Sometimes a Perl wrapper will need to call Lisp functions that return
a cons. If it is not a true list, there will be no way to get at its
elements, because there is no natural counterpart to '(a . b) in
Perl. Also, sometimes Perl code will want to, for example, remove an
element by doing $tail->setcdr ($tail->cdr->cdr).
And car and cdr are not good examples, I think; they're heavily
optimized already. Any attempt to speed them up ... you're rattling
coffins here ....
Speed them up? I'm just talking about using the CONSP, XCAR, and XCDR
macros from lisp.h instead of Ffuncall and intern("car"). (not to
mention the condition-case and unwind-protect that are required
whenever passing control to Lisp)
John> I'm not sure why any of this concerns Lisp
programmers,
John> unless they choose to use Perl.
Because they shouldn't have to care what's in any package that XEmacs
can execute. So they might be using Perl, but they shouldn't have to
know it. Worse, a package that they thought was Lisp (because that's
the language it was written in) could require a Perl module.
I'm still not following you. Are you suggesting that Perl programmers
are so culturally different from Lisp programmers that their ideas of
what a function should do will confound each other? I think most
programmers will look at existing code that does kind of what they
want and mimic its interfaces. In this case, the first XEmacs Perl
programmers will look at Lisp code.
John> So, if I understand you, XEmacs can be linked as a
library
John> and dynamically loaded? What about unexec?
Yes to the first. I don't understand unexec, so I can't answer that.
I might in fact go for a Perl-module solution if I knew we wouldn't
have to wait for `-l loadup' with each invocation. But as I
understand it, unexec does not produce dynamic libs.
John> It is possible to override some core Perl functions. I
John> believe `open' is among them. Already, I have written a
John> tied version of Perl's %ENV hash that updates
John> `process-environment'. I plan to coordinate signal handlers
John> using a similar strategy.
OK, that all sounds doable. But there's a lot of stuff that Perl can
do, and that XEmacs can do; I don't see how we can claim to be trying
to guarantee no dangerous interactions of the kind referenced in my
hypothetical splash screen. That's what
XEmacs.org means when it says
"XEmacs supports" AFAIK.
At the moment, there is one function through which all Lisp-to-Perl
transfers of control go, apart from initializing and destroying the
interpreter.
There are two for Perl-to-Lisp: one that creates an editor instance
(which I will sacrifice if need be) and one that sets up a stack frame
and calls Ffuncall. It is exactly because of the possibility of
dangerous interactions that I restricted things in this way.
John> However, that simply does not appeal to me. An
embedded
John> interpreter is more elegant, in my opinion, so it is what I
John> chose to work on.
Well, you have my best wishes;
thank you :-)
that's as good a reason as I've heard
for working on anything. But I've heard enough to know that, speaking
for exactly one person, I'm not much interested in the goals you've
stated. I admit that there are times when I would use a limited Perl
functionality to munge buffers (although fewer as time goes on), but
the halfway house you describe sounds too unpredictable to me for
writing reusable packages; I'll stick to `shell-command-on-region'
plus a few extra keystrokes where necessary.
Well, you'll always be able to do shell-command-on-region. Your
concerns are appreciated, and they should probably be listed in the
documentation in one form or another. This is not a commercial
product, so we are free to be very upfront and forthright about
potential problems.