Re: Enhance [proc] for anonymous functions and closures
- From: Bruce Hartweg <bruce-news@xxxxxxxxxx>
- Date: Wed, 02 Apr 2008 17:49:22 -0500
EL wrote:
Hi,
I have filed the feature request below to the tracking system at http://tcl.sourceforge.net/ and would like to have some feedback from other users here as well...
How realistic is this, and how desireable? Is it possible at all, in a certain time frame and what would this time frame be, approximately?
Asking as somebody who has no clue about interpreter implementation and very few clue about compiler implementation...
Thanks,
Eckhard
----- Feature Request 1932618 -----
I would like to request that [proc] becomes a data type in addition to a command, so that procs can be
- created on the fly, capturing the current environment and procedure stack
- created anonymously, e.g. [proc {} {...}] would return a new proc to be used elsewhere.
- returned by other proc's
- given as arguments to other procs (including their arguments and the environment in which they were created)
When this s possible, I think it would also be possible to have closures in Tcl and better capabilities for functional programming - which would enhance the language *a lot*
Is it possible to have [proc] as a Tcl_Obj* type?
have you looked at the new apply command in 8.5?
http://www.tcl.tk/man/tcl8.5/TclCmd/apply.htm
also check out the TIP that introduced it
http://www.tcl.tk/cgi-bin/tct/tip/194
it has some discussion of uses and how to use it for
other FP constructs.
Bruce
.
- References:
- Prev by Date: Re: strange item moving behavior in tk canvas
- Next by Date: Re: Update using teacup
- Previous by thread: Re: Enhance [proc] for anonymous functions and closures
- Next by thread: Re: Enhance [proc] for anonymous functions and closures
- Index(es):
Relevant Pages
|