texmacs-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Texmacs-dev] Re: [TeXmacs] Re: with-cursor macro


From: David Allouche
Subject: Re: [Texmacs-dev] Re: [TeXmacs] Re: with-cursor macro
Date: Tue, 18 Apr 2006 13:52:46 +0200

On Sat, 2006-03-04 at 00:32 +0100, Henri Lesourd wrote:
> David MENTRE wrote:
> >>Thus your code must *never* do any error with the paths...
> >>    
> >>
> >
> >Reading such sentences is pretty horrifying to me! TeXmacs should never
> >crash due to an error in a Scheme script. It should give an meaningful
> >error message.
> >
> I know... :-(

C++ has a language feature to help deal with such situations. It's
called "exceptions". GUILE also supports exceptions.

TeXmacs is compiled with exception support explicitly disabled. Last
time I talked to Joris about using this language feature, he refused it
on the ground that it caused a huge performance hit for little benefit.

Maybe the state of GCC has improved enough to make using exceptions
practical today. This decision was based on GCC-2.x C++ support, which
was notoriously horrible, leading to the egcs fork and eventually to
GCC-3.x. So it is reasonable to expect that support for a C++ specific
feature like exceptions has greatly improved.

Implementing basic bound checking and raising exceptions in Array access
methods, then translating those exceptions to GUILE in the Scheme glue,
would implement the desired functionality. A proof of concept should be
a week-end sized project.

The penalty for bound checking could be significant, since TeXmacs is
very heavy on tree traversal. It would be difficult to make the overhead
optional. I think it would be doable using the Visitor pattern, but this
may be a tricky problem. However, such a decision would have to be based
on performance measurements. If tree traversal performance is dominated
by CPU cache misses, bound checking cost would be negligible.
-- 
                                                            -- ddaa

Attachment: signature.asc
Description: This is a digitally signed message part


reply via email to

[Prev in Thread] Current Thread [Next in Thread]