Closed kennethrapp closed 5 years ago
I've encountered a similar error for other Racket functions that return #f
sometimes but not always. If you're not expecting the #f
case to come up in practice, the failure isn't very graceful.
Arc has a convention of saying (isa x 'string)
and such. This calls type
, which causes an error for unrecognized Racket values.
I believe the type it returns for #f
should be sym
(to match the other places Arc already treats #f
as identical to nil
, such as (is #f nil)
).
For other Racket values, I think we should have type
return a value of some sort rather than causing an error. Arc wasn't originally designed for Arc programs to incorporate arbitrary Racket expressions; the $
operator is more of an Anarki feature. Now that Anarki has had this kind of pervasive interaction with Racket for a long time, I think having (isa x 'string)
raise an error for unrecognized Racket values isn't a great choice. I recommend having type
return something like 'misc
or 'other
for unrecognized values. Arc code usually shouldn't rely on the specific value because some values may be recognized someday, but at least Arc code can then count on a proper nil
result for (isa x 'string)
.
@kennethrapp, would you mind providing a small-as-possible Arc code snippet to illustrate how Arc doesn't recognize those Racket booleans?
I think this may be resolved over on the Forum.
JSON strings parsed by Racket's JSON library containing boolean values generate Racket booleans #t and #f which are not recognized by Arc, and which generate an unrecognized type error.