Re: Discussion: Closures

Patrick Niemeyer <[email protected]> Thu, 3 Feb 2005 13:32:26 -0600
Newsgroups gmane.comp.java.beanshell.devel
Message-ID <[email protected]>
On Feb 3, 2005, at 11:37 AM, [email protected] wrote:

> x() { foo=someMethod(); ... }
>
> but then 'x' denotes a value that can be passed around just like 
> anything else. In an assignment statement such as"

It would not be hard to pass around BeanShell methods as closures (you 
can technically do it now it's just not syntactically appealing).  But 
as you point out, it seems that one of the more compelling usages is 
for anonymous closures.  There is also the issue that currently 
BeanShell method and variable names are separate spaces, e.g. you can 
say:

foo=foo();


> but I'd prefer something more beanshell like:
>
> (param1, param2) { body }

This is something I thought about a little... but what happens when 
there are no parameters?

() { body };

It gets much less recognizable.


Pat



-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl