On 1/15/24 18:28, John Cowan wrote:
On Sun, Jan 14, 2024 at 12:59 PM Per Bothner <[email protected]
<mailto:[email protected]>> wrote:
If you want a predicate to detect invalid code points (why? - what is the
use case?)
Because it's not a character. (Are you sure you don't mean an unassigned code
point? That should not be an error.)
I was using "invalid" in response to Brad Lucier's message. We probably should have used
"unassigned".
I'm thinking very operationally: (char? x) should return true iff the "type tag" of x is
"character".
In a Java or CLR implementation "type tag" might mean the result of a
getClass() method call.
I don't see any good reason to make char? more complicated or more specific.
Of course this does not preclude signalling an error if a "character
constructor" (such
as the integer->char procedure) is passed invalid arguments. However, sting-ref
should
never fail if the index is in range.
--
--Per Bothner
[email protected] http://per.bothner.com/