[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: srfi-9 record type checking
From: |
Neil Jerram |
Subject: |
Re: srfi-9 record type checking |
Date: |
Wed, 07 Jun 2006 23:18:21 +0100 |
User-agent: |
Gnus/5.1007 (Gnus v5.10.7) Emacs/21.4 (gnu/linux) |
address@hidden (Ludovic Courtès) writes:
> Kevin Ryde <address@hidden> writes:
>
>> I guess `define-record-type' should be making a stricter procedure
>> than `record-accessor' gives.
>>
>> I got bitten by this using `record-accessor' the other day. For some
>> reason I thought it had strict type checking and scratched my head for
>> a while until realizing I was passing a wrong record and getting back
>> #f. Is that #f a feature? Would there be scope to add an option to
>> ask for a strict checking version? Or make that the default?
>
> I don't think we can add an optional argument to `record-accessor' while
> preserving the current behavior by default. That optional argument
> would have to be more than just a default value: typically it would have
> to be a wrong-type-arg handling procedure, and this would add too much
> overhead IMO (OTOH, one may argue that we shouldn't worry too much about
> overhead in error conditions).
>
> Instead, we could perhaps add `record-type-strict-accessor'?
I vote for just fixing record-accessor to be strict by default;
i.e. treating current behaviour as a bug. I'd be surprised if anyone
was relying on this, and if they are it's easy to code a workaround.
Regards,
Neil