Artifacts Associated With Ticket 1011429fffffffffffffffffffffffffffffffff
Ticket change [04ce046a2f] (rid 88936) by dkf on 2004-08-18 13:23:19:
- assignee initialized to: "msofer"
- cmimetype initialized to: "text/plain"
- comment initialized to:
It'd be great if we could have variables associated with a procedure (specifically with a Proc structure instance) since that would make it much easier to do things like accumulator functions, unique id generators, etc. Further ideas on syntax: proc cmdName {formalArgs} {persistentVars} body The syntax of persistentVars would be a list like formalArgs. If a default is present for a pv, set the pv to that value when the procedure is created. Otherwise the pv is initially non-existant. No special handling of 'args', of course. All pvs to be automatically present in the local var env when executing the body, just like formals. PVs are not (necessarily) modified when the procedure exits. PVs are deleted when the proc is deleted. Probably also need [info] subcommand for introspection on PVs. :^) - foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "dkf"
- subsystem initialized to: "22. [proc] and [uplevel]"
- title initialized to: "Procedure-bound persistent vars"
- type initialized to: "RFE"
Ticket change [6de74c252d] (rid 128784) by dkf on 2004-08-18 20:24:58:
- icomment:
Logged In: YES user_id=79902 Note: This FRQ submitted so I don't forget it. It follows on from a discussion on the chat (16 Aug 2004)
- login: "dkf"
- mimetype: "text/plain"
- username: "dkf"
- icomment:
Ticket change [1f35ffc44a] (rid 91108) by hobbs on 2004-08-18 23:48:29:
- icomment:
Logged In: YES user_id=72656 This could easily be done with a 'static' command implemented in Tcl (likely already been done). Use of [info level] [upvar] and [uplevel] has all the magic you need.
- login: "hobbs"
- mimetype: "text/plain"
- username: "hobbs"
- icomment:
Ticket change [da3ff04353] (rid 147954) by dkf on 2016-07-12 19:24:27:
- closedate changed to: "2457582.30865159"
- closer changed to: "dkf"
- comment changed to:
It'd be great if we could have variables associated with a procedure (specifically with a Proc structure instance) since that would make it much easier to do things like accumulator functions, unique id generators, etc. Further ideas on syntax: proc cmdName {formalArgs} {persistentVars} body The syntax of persistentVars would be a list like formalArgs. If a default is present for a pv, set the pv to that value when the procedure is created. Otherwise the pv is initially non-existant. No special handling of 'args', of course. All pvs to be automatically present in the local var env when executing the body, just like formals. PVs are not (necessarily) modified when the procedure exits. PVs are deleted when the proc is deleted. Probably also need [info] subcommand for introspection on PVs. :^) - icomment:
Coroutines give us the capability to do the effects from this.
- login: "dkf"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Out of Date"
- severity changed to: "Minor"
- status changed to: "Closed"