Dashboard > BeanShell > ... > Proposed Enhancements and Discussion > Enhancement - Support for anonymous closures
  BeanShell Log In   View a printable version of the current page.  
  Enhancement - Support for anonymous closures
Added by Daniel Leuck, last edited by Daniel Leuck on Sep 18, 2006
Labels: 
(None)

From Pat's original posting:

I think the Java block syntax is a natural place to look... Java
has no notion of blocks appearing in either assignments or in arguments, e.g.:

code = { ... };
   someMethod( { ... } );

The same applies to method declarations:

method = foo(a,b) \{ \};
   someMethod( foo(a,b) \{ \} );

This syntax might also take the place of named arguments (another feature
request), as you could use an anonymous closure as a set of named arguments,
e.g.:

someMethod( { name="Joe"; address="1234 Foo St." } );

or they could be unified in some way (use the named argument syntax with
regular commas, but internally treat it as a closure).

Please see the "dialects" proposal for additional possibilities. (link TODO)

Site powered by a free Open Source Project / Non-profit License (more) of Confluence - the Enterprise wiki.
Learn more or evaluate Confluence for your organisation.
Powered by Atlassian Confluence, the Enterprise Wiki. (Version: 2.2.8 Build:#525 Aug 08, 2006) - Bug/feature request - Contact Administrators