[R6RS] Rationale for INIT! clause
Anton van Straaten
anton
Mon Aug 1 06:12:23 EDT 2005
Michael Sperber wrote:
> Many thanks for the comments, Will!
>
> One issue stands out:
>
> William D Clinger <will at ccs.neu.edu> writes:
>
>
>>9) I would not be averse to dropping the init! <record clause>,
>>but I can see why it is useful and how it would encourage people
>>to write code that can be compiled more efficiently.
>
...
>
> Generally, the initialization mechanism and INIT!, taken together,
> provide an abstraction over a very common pattern of record
> construction.
...
>
> My personal experience suggests that this pattern---making use of
> non-standard field initialization or "registering" the record
> somewhere---occurs in a large percentage (somewhere betweeen 30%-40%,
> I'd say) of record definitions, which, IMHO, justifies encoding the
> pattern in the abstraction.
I agree. It's something that users need to do, i.e. it's a common
requirement that exists whether or not R6RS satisfies it. We should
satisfy it.
> Moreover, to use this together with a DEFINE-TYPE-like facility
> without the INIT! clause, you need to do this:
>
> (define-type (foo really-make-foo foo?) (a b c)
> ...)
>
> (Likewise if you don't have the initialization mechanism.)
>
> This means that the name of the "actual constructor" MAKE-FOO that
> programs are supposed to use is no longer part of the DEFINE-TYPE
> form---whether implicit or explicit.
Yes, this bugs me in the record systems which require it, and it seems
like a clear usability flaw.
> We probably need to add a Design Rationale explaining stuff like this,
> and possibly add one or two issue bulletts. I'll see what I can
> figure out later today.
I'm willing to help with this.
Anton
More information about the R6RS
mailing list