[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why generative?



On 09/03/2009 02:46 AM, Shiro Kawai wrote:
From: will@xxxxxxxxxxx
For record types that are not defined at top level, it is
unclear whether generative or non-generative definitions are
more common.  My intuition says it's likely to depend upon
individual programmers' preferred styles, so no general rule
applies generally.

Probably this point is our difference.  I often like to use
locally defined records to group values semantically, and
such record types should be non-generative to avoid overhead.
But that's a matter of personal preference, so I don't push
this use case particularly.

Some implementations might want an extension to make-rtd or
define-record-type that would allow defining methods as well
as fields.  Or alternatively an implementation-specific
function/syntax to do so.  (Kawa has a define-class form.)

If so, then the method might refer variables in the lexical
scope.  In which case the record-type would presumably need
to be non-generative, since it needs to be to access the local
closure.

So for consistency I think the default should be generative.
--
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/