RE: Discussion: Closures
"Frost, Gary" <[email protected]> Thu, 3 Feb 2005 13:42:45 -0600
| Newsgroups | gmane.comp.java.beanshell.devel |
|---|---|
| Message-ID | <E9DE7963E5EA6546B42A979EC28B4D0109388705@hou-ex-02.adprod.bmc.com> |
How about
{parm1, param2{body}}
Where the no parameter version might be:
{{body}}
Making the use of closures distinct and obvious to the compiler and fairly
easy for coder.
So one could extend the notion of the for loop...
for (a;b;c;{a{body}})
or have
myclosure = {a,b{print(a+" and "+b}};
Just a thought.
-----Original Message-----
From: Patrick Niemeyer [mailto:[email protected]]
Sent: Thursday, February 03, 2005 1:32 PM
To: [email protected]
Cc: BeanShell Developers
Subject: Re: [Beanshell-dev] Discussion: Closures
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
_______________________________________________
Beanshell-developers mailing list
Beanshell-developers-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org
https://lists.sourceforge.net/lists/listinfo/beanshell-developers
-------------------------------------------------------
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