Matthew Flatt wrote:
At Tue, 6 Apr 2010 14:12:35 -0400, Carl Eastlund wrote:
[...]
I like being able to read something and know whether it is (a) a
definition form and (b) introducing new bindings into the current
scope. If we changed, for instance, define-signature to simply
signature, there would be nothing to indicate to a user of both units
and classes that signature is a definition, whereas interface is
merely a value constructor, despite the two otherwise performing very
similar roles.
Along the lines of my other message, I agree that we shouldn't change
`define-signature'. It binds the name that appears right after the
`define-signature', so the `define-' is a strong and appropriate
signal.
I don't think the fact that it binds the supplied name and nothing else
is the significant part. I have a macro that defines names associated
with struct properties; given 'PROP', it defines 'PROP', 'PROP?' and
'PROP-value' for the property, its predicate, and its accessor,
respectively. The macro is called 'define-struct-property'; chopping off
the 'define-' prefix because it defines generated names would be a bad
idea. It would destroy the benefits that Carl mentions above.
But `require' and `open-package' also bind in the enclosing scope. So
do `init' and `field'. I expect that there are more examples.
Meanwhile, local-binding forms are considerably more varied: `let',
`syntax-case', `match', etc.
I think `struct' is prominent enough that it will stand out, if we go
with it, much as `require' does.
'require' is significant enough that it trumps definition-ness. Within
the context of the class macro, so are 'init' and 'define'. I'm not sure
about 'open-package'---I don't use packages.
'struct' might be okay, but only because structs are important and
everyone knows about structs, not because labeling definition forms with
'define-' is a waste of characters. In particular, I disagree with Jay's
summary:
Jay McCarthy wrote:
> You've convinced me, Matthew. I like the rule that 'define...' names
> everything that it binds and anything that makes stuff up shouldn't be
> a 'define...'
----
BTW, we should have a distinct scribble form (defdefform) for definition
forms with a standard place for listing the names they bind. This is
doubly necessary if we're going to encourage definition forms that don't
look like definition forms.
Ryan
_________________________________________________
For list-related administrative tasks:
http://list.cs.brown.edu/mailman/listinfo/plt-dev