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

Re: <index-out-of-bounds-error>



In article <3C324E4A.4070709@quiotix.com>, Jeffrey Siegal 
<jbs@quiotix.com> wrote:

> Bruce Hoult wrote:
> 
> > It's not thrown away.  The <simple-error> contains not only the error 
> > text but also a reference to the actual collection object (vector, 
> > string etc) and the index value that caused the problem.
> 
> Yes, but how will a program know how to classify/interpret that?  Your 
> earlier remarks:
> 
>    with an appropriate message/format string and arguments
> 
> suggested that it was basically a human-readable format.

Well, specifically, the error text in GD for sequences (collections that 
can be indexed by an integer, including strings, vectors, and lists) is 
"No element %d in %=".  In non-portable code you could explicitly match 
against that.  Ick.  But the actual collection and the index are also 
there, so you can do things such as inquire into the class of the 
collection, or its size.

If you have a suggestion for an appropriate design for a hierachy of 
error classes then I believe we would be interested in hearing about it.  
diffs to the current source code are even better :-)


> > As it's an open project, anyone is welcome to implement such a 
> > heirarchy 
> > if they feel a need for it.  They can even copy what Functional 
> > Developer does, if they want.  Which would then mean we could call it a 
> > standard :-)   (or persuade them to change if they did something silly)
> 
> It doesn't sound like what FD does is very interesting in this regard 
> either, since they apparently they don't export the relevant error types.

GD is open source and therefore very easy for anyone to change.  But the 
FD guys have historically shown themselves to be happy to take 
suggestions and correct gratuitous incompatabilities.  They are not 
bureaucratic.

-- Bruce