Artifacts Associated With Ticket 1932618
Ticket change [48f20270be] (rid 99986) by ecky-l on 2008-04-02 20:20:05:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
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? - foundin initialized to: "None"
- is_private initialized to: "0"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "ecky-l"
- subsystem initialized to: "None"
- title initialized to:
Enhance [proc] for anonymous functions and closures
- type initialized to: "RFE"
Ticket change [f2ee65ceb6] (rid 109642) by andreas_kupries on 2008-04-03 03:24:17:
- icomment:
Logged In: YES user_id=75003 Originator: NO Is TIP #194: Procedures as Values via '''apply''' (http://tip.tcl.tk/194) what you seek ? If yes then please try out Tcl 8.5 there this is implemented.
- login: "andreas_kupries"
- mimetype: "text/plain"
- username: "andreas_kupries"
- icomment:
Ticket change [11f316b388] (rid 95230) by msofer on 2008-04-05 20:08:18:
- assignee changed to: "msofer"
- icomment:
Logged In: YES user_id=148712 Originator: NO Taking ownership as it is close to other things on my plate. See also clt thread at http://groups.google.com/group/comp.lang.tcl/browse_thread/thread/ffa48b75264ae4db/0226ae5e1f6bd115?lnk=raot#0226ae5e1f6bd115
- login: "msofer"
- mimetype: "text/plain"
- username: "msofer"
Ticket change [6b311c70d3] (rid 147957) by dkf on 2016-07-12 19:27:38:
- closer changed to: "nobody"
- comment changed to:
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? - login: "dkf"
- mimetype: "text/plain"
- severity changed to: "Minor"
- subsystem changed to: "22. [proc] and [uplevel]"
Ticket change [56c9c2542f] (rid 148014) by dkf on 2016-07-14 07:26:05:
- assignee changed to: "dkf"
- icomment:
This is genuinely tricky to do without introducing some whopper incompatibilities at the deep semantic level. In particular, "capturing the current environment" is difficult without causing deep trouble with values that are not properly serializable (unlike <i>all</i> current Tcl-defined values). The problem is that <tt>proc</tt> creates commands, and command handles are single values with an expectation that they can be used transparently. However, you can do a lot with <tt>coroutine</tt> and <tt>apply</tt> without tackling the deeply difficult parts. You can also do a lot more if you're creating a <tt>method</tt> and not a procedure call; the extra context (and the expectation of calling the code via an object handle) make a big difference. Finally, you also gain options if you drop the expectation of being able to modify captured variables and have those modifications persist. (There are also issues relating to what the expected captured stack would look like; I <i>really</i> recommend not trying to capture that without a <tt>coroutine</tt>!) For example, if you drop being usable a single value and modifying the captures, you can do it with <tt>apply</tt> and some creative scripting.
- login: "dkf"
- mimetype: "text/x-fossil-wiki"