On Wed, Dec 26, 2012 at 9:42 AM, Volker Braun <vbraun.n...@gmail.com> wrote:

> Pexpect is a nice trick if you want to get off the ground quickly in
> interfacing another program, but the strategic goal should be to turn it
> into a shared library or develop a RPC call library that we can plumb into
> the source code.
>

I just want to clarify what I think Volker is saying here.  He's say: "the
strategic goal for any component of Sage that uses pexpect (e.g., Maxima,
Gap, Pari, Singular, etc.) is to instead using a shared library interface
or ...".

This isn't an option in some cases in which we use pexpect, e.g., probably
not for KASH, since KASH is closed source and mostly abandoned.

Also, there is one possible advantage to pexpect over a shared library: you
can easily control run multiple separate processes using pexpect, which can
be running on possibly different computers.  (Of course, you could do
something similar with multiple Python processes, so this is a dubious
advantage.)


> Your average scientific code is just a scanf/printf loop so it would be
> easy to replace those calls with our own.
>
> I don't think that pexpect can be significantly better implemented, all
> the trouble comes from possible timing or buffering issues. At the core its
> a very simple process, its only difficult to make it work well on a large
> number of platforms.
>

Having used it a lot, I tend to agree.  Over the years, our use of pexpect
has been debugged in various ways.  There have been numerous very subtle
timing and memory allocation bugs in our *usage* of pexpect that got fixed
over the years (I'm thinking mainly of things that Carl Witty and Mike
Hansen tracked down).   Rewriting the pexpect code itself in Cython would
make little difference, since it is already mostly using existing C code
from the Python library, for forking and for regular expression detection.

Having written a lot of async javascript code lately, making a version of
the pexpect interfaces that is asynchronous seems kind of interesting,
e.g., with callbacks (or whatever).  This would be something that would
probably only fit into the world of Twisted.





> On Wednesday, December 26, 2012 5:13:45 PM UTC, Jeroen Demeyer wrote:
>>
>> I think it would be best to rewrite it essentially from scratch, in
>> Cython.
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To post to this group, send email to sage-devel@googlegroups.com.
> To unsubscribe from this group, send email to
> sage-devel+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel?hl=en.
>
>
>



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.


Reply via email to