[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: <index-out-of-bounds-error>
Bruce Hoult wrote:
>
> In article <3C31FDAE.EB1F7EA7@mediaone.net>, Carl Gay
> <carlgay@mediaone.net> wrote:
>
> > I notice that in FunDev ""[0] signals <invalid-index-error> but
> > I can't catch it because it's not exported from any library (as
> > far as I can tell). The best I can do is catch <simple-error>.
> > I don't know what Gwydion does.
>
> For such things, Gwydion currently throws a <simple-error> with an
> appropriate message/format string and arguments.
>
> > Should there be a standardized <index-out-of-bounds-error> class
> > exported from common-dylan? Or is there one in some other lib?
>
> Possibly. Why? What would you do with it?
>
The immediate reason was that I was writing an ad-hoc parser for
tags like <dsp:foo arg1="bar" arg2='baz'/> that appear in the
middle of HTML files. I pass around an end index (epos) and
found myself having to constantly check against epos to make
sure I didn't go past it. It would make my code much cleaner
to simply not worry about it and catch <index-out-of-bounds-error>
at a slightly higher level. I don't want to mask other errors
by catching <simple-error>, which would indicate a bug in my
program whereas <index-out-of-bounds-error> might be caused
by the user not closing a tag properly.