On Thu, Apr 10, 2008 at 08:52:38AM -0700, jerry gay wrote:
: On Wed, Apr 9, 2008 at 10:31 PM, John M. Dlugosz
: <[EMAIL PROTECTED]> wrote:
: > Consider the words that may be used to introduce a block for a special
: > purpose, like
: >
: >  BEGIN
: >  END
: >  INIT
: >  CATCH
: >  etc.
: >
: >  What do you call those?  They are not even "special named blocks" because
: > that is not the block name (that already means something).
: >
: syntactically speaking, http://svn.pugscode.org/pugs/src/perl6/STD.pm
: groups them in <statement_control>, just like 'if' and 'for'.
: semantically speaking, i don't have a clever or unique name for them,
: other than what larry has already come up with.

It's a really good question, particularly because it's so exposed to the
user, so it needs to be something not too unwieldy.  Semantically, they
are closures that are attached as properties of the surrounding lexical
scope, and since they're compile-time properties, they're declarative.
So we've been calling them closure traits.  But I pretty certain we
should be using the term "block" here instead, even though they are
technically closures (or potentially closures, depending on how you
define that).  But people will generally prefer the more concrete
"block" if there are always curlies involved, and people are already
used to saying "BEGIN block" and such.

And "traits" is also problematic; it says what they are, but not really
what they do.  They're really "come froms" with predefined names that
are automatically called at the appropriate time.  So I think perhaps
the best term for them might be something more like "event blocks",
blocks that are called if and when a particular event happens.  That's
a more user-oriented definition.


Reply via email to