Re: New draft (#8) of and new "last call" for SRFI 189: Maybe and Either: optional container types Marc Nieper-WiÃkirchen 14 Jul 2020 09:13 UTC
Am Sa., 11. Juli 2020 um 22:08 Uhr schrieb Arthur A. Gleckler <xxxxxx@speechcode.com>: > > On Sat, Jul 11, 2020 at 1:06 PM Marc Nieper-Wißkirchen <xxxxxx@nieper-wisskirchen.de> wrote: > >> >> Yes, indeed. I have been thinking of a replacement of SRFI 145, which >> will include John's idea to pull in "assert" from R6RS and my idea of >> linking "assume" to "assert" when a kind of debug flag is set (which >> should be the default). >> >> In error situations, which can, in principle be detected (like in the >> maybe-if case of SRFI 189), implementations are then encouraged to use >> "assume" (or even forced by the wording of the respective SRFI), which >> will give (a) the semantics John is looking for in normal runs and (b) >> allows a portable mode, in which the optimizer can work much more >> aggressively without changing the semantics. > > > That would be great. In order not to repeat everything that is said in SRFI 145, I think it is enough to have a SRFI 2XX "Assertions", which implements the predicate "assert-violation?" and the syntax "assert" from R6RS and which adds the following requirement: Any Scheme implementing SRFI 2XX has to implement SRFI 145 with the following additional requirements: (1) If the feature identifier "debug" is present, "assume" must expand into an equivalent "assert" form. (2) If the feature identifiers "debug" and "ndebug" aren't present, "assume" should report a non fulfilled assumption to the user in an implementation-depended way. (3) If the feature identifier "debug" is not present but "ndebug" is, the behavior of unfulfilled assumptions is implementation-dependent. (4) Implementations should set the feature identifier "debug" and disable the feature identifier "ndebug" by default. (5) Implementations should provide a way to (globally) set feature identifiers for the use in cond-expand. (6) In error situations where the error is easily detectable, implementations should guard against the error with "assume". Remark: (6) applied, for example, to procedures like "call-with-current-continuation", whose arguments have to be of a certain type, or to syntax like "maybe-if", whose argument have to evaluate to values of a certain type. Marc