Henri Lesourd | 4 Mar 2006 00:32
Picon
Favicon

Re: [TeXmacs] Re: with-cursor macro

David MENTRE wrote:

>Hello,
>
>[ Follow-up on texmacs-dev <at> , as this more a developer issue. ]
>
>Henri Lesourd <texmacs <at> free.fr> writes:
>  
>
>>Yes, of course :-( it crashes when you use an invalid
>>path, its exactly the same as with (go-to <path>), or
>>with other function, like (path-assign), for example.
>>
>>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... :-(
David Allouche | 18 Apr 2006 13:52

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

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.

(Continue reading)


Gmane