pyret-lang
pyret-lang copied to clipboard
Contracts on builtins
Many builltins, like _divide and substring, are partial, and give contract errors for erroneous inputs. We should turn these errors into meaningful Pyret errors somehow, and avoid paying to much to do so (that's the hard part).
Another problem along these lines --- "hello".tonumber() yields a number value that contains #f, because of inadequate checking on the result.
For now, I've committed 9a0803e, which changes tonumber to return
either a real number or nothing, rather than try to catch an
error...On 7/29/2013 4:05 PM, Joe Politz wrote:
Another problem along these lines --- "hello".tonumber()
yields a number value that contains #f, because of
inadequate checking on the result.
—
Reply to this email directly or view
it on GitHub.
Thanks. Good band-aid.
_divide(1,"2") seems to give Pyret-esque errors now, no?
When I try it, I get an internal error (field not found "left" on an s-program). @jswrenn over to you...
@jpolitz is this still an issue?
Yes, it's still exposing an internal error.