Hacker News new | ask | show | jobs
by zimpenfish 1939 days ago
> There are no bounds. > clever to return undef if you were out of bounds

You can see how this is getting confusing.

> So there is no error to catch.

Thing is, you're already catching the error because "Little code could actually tell you are past the end" and "return undef if you were out of bounds" - you're just smooshing the error under the carpet into an `undef` return rather than bombing out with an OOB error (which is what I think GP was actually after.)

(If Little returns `undef` for OOB and `""` for in-bounds-not-set, you can detect the OOB access error in your own code but that hasn't been made clear, I don't think?)

1 comments

Little returns undef for OOB and for in bounds not set. Tcl returns "" for both.

The thing that GP was asking for, an OOB error, is not a thing in a language where there are no bounds.