Re: Enhance [proc] for anonymous functions and closures



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

.



Relevant Pages

  • Re: Enhance [proc] for anonymous functions and closures
    ... 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... ... I would like to request that becomes a data type in addition to a command, ... given as arguments to other procs (including their arguments and the environment in which they were created) ... Is it possible to have [proc] as a Tcl_Obj* type? ...
    (comp.lang.tcl)
  • Re: WLM for toddlers
    ... If the application environment is stopped, the PROC is never invoked. ... It will invoke more PROCs, if applicable, if the AE is started. ... This is independent of DB2, except DB2 will use the associated PROC for DDF work. ...
    (bit.listserv.ibm-main)
  • Re: response.write xml to browser - newbie dev test question
    ... Was hoping simple classic asp, but I have the environment and ... Heck, I'm just wanting a quickie way to view the xml spit out by the proc so ... I can tweak the proc as dev requires. ...
    (microsoft.public.sqlserver.xml)
  • First sp after re-start fails because of User-defined type
    ... I'm having a problem with SQL Server 7. ... because the data type is not recognised. ... creating a temporary table in the stored proc, ...
    (microsoft.public.sqlserver.server)