1. Re: in_range

Gabriel Boehme wrote:

> Why not just define index like this:
>
>   type index_value(integer x)
>      return x > 0
>   end type


Type is fine for debugging, but in a final application I like to leave some
error checks - especially checks like this - in the code, so I can attempt
to gracefully recover.

In addition, the value not being in range isn't always an error. For an
obscure (and bad) example, I use this test to determine if a value is an
index (relatively small) or a handle (typically large). The code ran into
trouble when the handles became so large, the values were negative.

> I don't see the overriding necessity for an in_range() function.

I don't see an overriding necessity, either. But I think that an inclusion
of something like this might help create safer code.

-- David Cuny

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu