Am Fr., 9. Sept. 2022 um 22:15 Uhr schrieb John Cowan <[email protected]>:

>
>
> On Fri, Sep 9, 2022 at 2:24 AM Marc Nieper-Wißkirchen <
> [email protected]> wrote:
>
>> Note that you could also have `procedure/tag?` return `#t` in all
>> cases,
>
>
> I assume you mean for all procedures, rather than for all objects
> whatsoever.
>

Yes.


> which is probably better than exploiting the "is an error"
>> condition.
>>
>
> I don't understand the way the SRFI is supposed to work.  Suppose I wish
> to take an arbitrary procedure and obtain a tag on whose value I can
> depend. If procedure/tag? returned #t iff a procedure has a tag, that would
> work safely.  But since procedure/tag? can return #t on any procedure,
> procedure-tag might crash my program, and I have no way to defend against
> this.  So it is never safe to call procedure-tag unless I already know that
> the procedure is tagged.
>

No, if `procedure/tag?` returns `#t`, the procedure `procedure-tag` must
not crash.  And your implementation of `procedure-tag` does not crash on
any Chicken procedure, right?


> I would suggest an erratum that disallows procedure/tag? from returning #t
> on procedure p unless procedure/tag is guaranteed to return some result on
> p.
>

Such an erratum is not needed, I think.  The document says the following:
`Procedure/tag?` must not return `#t` on non-tagged procedures.
`Procedure-tag` must not crash on tagged procedures.  The point I was
referring to above is that SRFI 229 allows Scheme implementations where
every procedure is tagged, even those returned by `lambda`.  This is the
case with Chicken.

Reply via email to