debug feature identifier and coercion Antero Mejr (23 Aug 2024 19:31 UTC)
Re: debug feature identifier and coercion Artyom Bologov (24 Aug 2024 03:36 UTC)
Re: debug feature identifier and coercion Antero Mejr (24 Aug 2024 04:41 UTC)
Re: debug feature identifier and coercion Artyom Bologov (24 Aug 2024 06:01 UTC)
Re: debug feature identifier and coercion Arthur A. Gleckler (26 Aug 2024 05:24 UTC)

Re: debug feature identifier and coercion Artyom Bologov 24 Aug 2024 03:35 UTC

Hi Antero,

> Can language be added to specify that all checks should/must be disabled
> if the `debug` R7RS feature identifier is not set? Currently that is the
> case in the generic sample implementation because it uses SRFI 145
> `assume`, but in the spec there is nothing (that I can see) to indicate
> whether/how these checks can be turned off.

Indeed! I've sent a pull request (CC Arthur) with corrections already:
https://github.com/scheme-requests-for-implementation/srfi-253/pull/8

> Also the SRFI should more clearly specify when coercion is done IMO.
> Currently it says the `values-checked` form "might" coerce, but I think
> the default should be no coercion (and specify this for all forms), and
> that `*-coerce` variants be supplied, which must coerce when possible.

This one I'm not sure about. Several reasons for the current spec:

- Existing implementation practice. Kawa has an `as` form that coerces
  the passed values to the necessary type when possible. Kawa
  implementation of SRFI-253 uses `as` in `values-checked`, as the
  closest implementation-specific approximation of `values-checked`.

- Latent typing. Scheme is not strictly typed, so equating predicate
  with type is not always right. `integer?` in particular might be true
  on floats. And (generic) math operations convert between types
  frivolously. So coercion is consistent with the rest of Scheme.

- Semantics. My intention for `values-checked` was that it should
  guarantee that the value returned from it satisfies the
  predicate. Which is compatible with coercion. The language in the
  document doesn't reflects that, though. I've sent an edit:
  https://github.com/scheme-requests-for-implementation/srfi-253/pull/10

Hopefully that makes sense!

Thanks,
--
Artyom Bologov
https://aartaka.me