On Sun, Mar 31, 2024 at 10:46:34PM +0200, Ralf Hemmecke wrote:
> Hello Waldek,
> 
> > Attached is a little patch which changes error function to
> > 'error3' and adds two extra paramters, that is constructor name
> > and function name.
> > 
> > You need to add definition of 'error3', for example:
> > 
> > error3(con, fun, mess) ==
> >      errorSupervisor($AlgebraError, [STRCONC(con, '"$", fun, '": "), mess])
> > 
> > Note: to test patch 'compiler.boot' and read it.  Then read
> > boot file with definition of 'error3'.
> 
> Thank you for that patch. That is really progress. And helps me a lot.
> Looks good to me, at least.
> 
> I only think that it would be better to use
> 
> ========
> error3(con, fun, mess) ==
>     errorSupervisor($AlgebraError, [STRCONC(fun, '" $ ", con, '": "), mess])
> ========
> 
> that is, spaces around $, and fun and con excanged.

Yes, fun should go first.  I do not understand why you want spaces
around '$'.  Usual way it to write this without extra spaces,
also in hand written error messages.

> 
> I also saw that it might be possible that fun and/or con could be NIL. I do
> not yet see where that could happen, but maybe for those cases the code of
> error3 should be different.

Well, the patch is just proof of concept.  There are corner cases
which should be handled in reasonable way.  Note that initialization of
constructors is outside functions, so there in no function name.
And initialization may signal errors.  I am not sure if constructor
can be NIL, that should be investigated before commiting better
version.  Also, for nested functions '$op' contains name of surrounding
function.  In case of anonymous functions we have no name.  That
should be handled in some way.

Note that currently there are two legal variants of error, the second
one allowing math formatting.  The patch only handles first form, the
second one needs a bit more work.

-- 
                              Waldek Hebisch

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/ZgnjVv28Czu-I_2W%40fricas.org.

Reply via email to