|
From: Kostas O. <k.o...@at...> - 2014-10-24 12:48:57
|
Thank you Arthur and Rainer. I was using 'rerror' instead of
'rederror' because of what I read in sec. 6.1 of the Melenk primer.
Given what both of you said, my thinking now is to revert to using
'rederrror' throughout and not bother with error numbers, symbolic or not.
Kostas
On 10/24/2014 06:44, Rainer Schöpf wrote:
> Two remarks:
>
> 1. I suspect that the calls to rerror were intended as a start point for a more
> specific error management. E.g., by passing an error number and a module name,
> Reduce would be able display a corresponding help document. This is a good idea,
> but we would need to (a) convert everything to that scheme and (b) write
> documentation for the errors - which would be a Good Thing anyway.
>
> 2. There is a way to use symbolic error names. If you write
>
> put('listerr,'newnam,1);
>
> you instruct the parser to replace _every_ occurence of the token listerr by the
> token 1. Consequently, you can write
>
> rerror('nlopt, listerr, {"list of size", n, "expected!"});
>
> You have to be careful to use identifiers that are not used elsewhere, so
>
> !E!R!R!O!R!-list!-expected
>
> would be a better (and more easily understandable) identifier.
>
> Rainer
>
>
>
> On Fri, 24 Oct 2014 at 08:21 +0100, Arthur Norman wrote:
>
> > I am replying to this via the general list first in case it is useful to
> > anybody else and secondly because an attempt at a direct response saw my
> > email bounced, so I hope this is a way to get through.
> >
> > On Thu, 23 Oct 2014, Kostas Oikonomou wrote:
> > > Is it possible to define a "constant" in your module and use it as an
> > > error number in 'rerror(...)'?
> > > 'rerror' seems to require a literal integer. Managing error numbers by
> > > literal integers is difficult.
> > > So I'd like to be able to say smth. like
> > > listerr := 1
> > > ...
> > > if not listp(bounds) or length(bounds) neq n+1 then
> > > rerror('nlopt, listerr, {"list of size", n, "expected!"});
> > > But doing this results in
> > > ***** liberr invalid as RERROR argument
> > > Thanks.
> > > Kostas
> >
> > The effect you observe arises in formrerror in rlisp/form.red which is
> > imposing constraints on the arguments to rerror and permitting us without a
> > quote of arg1.
> >
> > symbolic procedure formrerror(u,vars,mode);
> > begin scalar x;
> > argnochk u;
> > if not fixp caddr u then typerr(caddr u,"RERROR argument");
> > x := formc!*(cadddr u,vars,mode);
> > if idp cadr u then return list('rerror,mkquote cadr u,caddr u,x)
> > else if eqcar(cadr u,'quote) and idp cadadr u
> > then return list('rerror,cadr u,caddr u,x)
> > else typerr(cadr u,"RERROR argument")
> > end;
> >
> > so that indeed explicitly insists on a literal numeric argument.
> >
> > If you look in rlisp/lpri.red you see
> >
> > symbolic procedure rerror(packagename,number,message);
> > progn(errmsg!* := message, rederr message);
> >
> > and rerror discards/ignores its first two arguments, so there is to my mind
> > little huge purpose of using it rather then just calling rederr directly!
> >
> > Arthur
> >
> >
> > ------------------------------------------------------------------------------
> > _______________________________________________
> > Reduce-algebra-developers mailing list
> > Red...@li...
> > https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers
> >
>
> Rainer Schöpf
>
>
> ------------------------------------------------------------------------------
>
>
> _______________________________________________
> Reduce-algebra-developers mailing list
> Red...@li...
> https://lists.sourceforge.net/lists/listinfo/reduce-algebra-developers
|