Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-02-02
02:26 • Closed ticket [944803ffff]: new apply command plus 8 other changes artifact: a8062ea9db user: dgp
02:12 • Ticket [944803ffff]: 4 changes artifact: 712c57c4e2 user: dgp
02:12 • Add attachment 944803.patch to ticket [944803ffff] artifact: b9b2f1feb3 user: dgp
2006-01-22
09:03 • Ticket [944803ffff] new apply command status still Open with 4 other chang... artifact: abc1e6c14e user: msofer
09:03 • Add attachment apply.test to ticket [944803ffff] artifact: 30dce24896 user: msofer
09:02 • Ticket [944803ffff] new apply command status still Open with 4 other chang... artifact: 4e64def26d user: msofer
09:02 • Add attachment apply5.patch to ticket [944803ffff] artifact: a5e3acc43e user: msofer
09:02 • Ticket [944803ffff] new apply command status still Open with 4 other chang... artifact: 00d2abc65a user: msofer
2006-01-19
05:46 • Ticket [944803ffff]: 4 changes artifact: fb5c3c4efb user: msofer
05:46 • Add attachment apply4.patch to ticket [944803ffff] artifact: cc1878d353 user: msofer
05:46 • Ticket [944803ffff] new apply command status still Open with 4 other chang... artifact: 193ed8672f user: msofer
2006-01-12
05:47 • Ticket [944803ffff]: 4 changes artifact: 0f2dac303d user: msofer
05:33 • Add attachment apply3.patch to ticket [944803ffff] artifact: ea2d45ca48 user: msofer
05:33 • Ticket [944803ffff] new apply command status still Open with 4 other chang... artifact: 75edb6a645 user: msofer
2004-08-23
08:09 • Ticket [944803ffff]: 4 changes artifact: 7a9080c665 user: coldstore
08:09 • Add attachment procns2.patch to ticket [944803ffff] artifact: 7317f0c6af user: coldstore
08:09 • Ticket [944803ffff] new apply command status still Open with 4 other chang... artifact: fe8dac2f1d user: coldstore
06:41 • Ticket [944803ffff]: 4 changes artifact: f230b6ae05 user: coldstore
06:41 • Add attachment procns.diff to ticket [944803ffff] artifact: 248daf29fb user: coldstore
06:41 • Ticket [944803ffff] new apply command status still Open with 4 other chang... artifact: 360e1ce1cb user: coldstore
2004-04-30
17:28 • Ticket [944803ffff]: 4 changes artifact: fef6d9bc41 user: msofer
17:28 • Add attachment apply2.patch to ticket [944803ffff] artifact: deb2a1627c user: msofer
15:43 • Ticket [944803ffff] new apply command status still Open with 4 other chang... artifact: 96660bd2e0 user: dkf
01:54 • Ticket [944803ffff]: 4 changes artifact: 91dbc6494b user: msofer
01:54 • Add attachment apply.patch to ticket [944803ffff] artifact: d4a8995b8b user: msofer
2004-04-29
18:54 • New ticket [944803ffff] new apply command. artifact: 4b4a76f665 user: msofer

new [apply] command

Closed / Accepted944803ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 21 years ago
Descriptionplain2004-04-29 18:54:44
A proposed new [apply] command to apply anonymous
functions, giving one possible (but different)
implementation for the goals of TIP 187 (Functions as
Values).
Attaching a patch that provides the command; a possible
manual page is at http://utdt.edu/~mig/apply.html.
msoferplain2004-04-30 01:54:45
File Added - 85535: apply.patch
dkfplain2004-04-30 15:43:29
Logged In: YES 
user_id=79902

Issues, some of which are not serious in demo code:
 * Which is the correct namespace to execute in?
 * The errorInfo messages are misleading
 * Should the guts of TclObjInterpProc be extracted so that
they can be called from [apply]?  IncrTcl (and other
extensions?) might also be a client of such a function, even
if it was internal, so whatever it is ought to go in the
stubs table.
msoferplain2004-04-30 17:28:36
File Added - 85602: apply2.patch

Logged In: YES 
user_id=148712

Addressing only the first issue, new apply2.patch with
manpage at http://utdt.edu/~mig/apply2.html

This version executes the anonymous function in the global
namespace by default, but a different (constant) namespace
can be specified.

The remaining two issues are still unaddressed; this is
experimental code, those matters will definitely be fixed
before applying.
coldstoreplain2004-08-23 06:41:15
Logged In: YES 
user_id=19214

Following discussion on tkchat, it is possible (and
desirable) to simplify struct Proc so that it no longer
requires a Command, but instead directly points to its
defining Namespace ... this will require further
modification to the [rename] command, to preserve rename
semantics (where renaming a command associated with a proc
will change the proc's Namespace) ... to be attached in a
different patch.

Justification: a proc needs to know its own namespace
(although except for the [variable] command, it's hard to
know precisely why ... more analysis work needs to be done)
but the additional requirement, that it possess an
associated command, doesn't seem warranted.

The included patch removes that requirement, and should
enable eventual simplification of Miguel's [apply] patch by
not absolutely requiring it to create a Command to associate
with an anonymous proc.

This simplification is beneficial with, or without, changes
to tcl semantics permitting direct evaluation of a Lambda
ObjType.
coldstoreplain2004-08-23 06:41:16
File Added - 98730: procns.diff
coldstoreplain2004-08-23 08:09:30
Logged In: YES 
user_id=19214

Second patch to remove Command* from Proc.

This handles [rename] and properly refcounts Namespace refs
held in Procs.
coldstoreplain2004-08-23 08:09:31
File Added - 98735: procns2.patch
msoferplain2006-01-12 05:33:00
File Added - 163010: apply3.patch

Logged In: YES 
user_id=148712

Updated patch apply3.patch, applies to HEAD.

Note that this is still a proof-of-concept: missing tests
and comments, for instance.
msoferplain2006-01-12 05:47:32
Logged In: YES 
user_id=148712

Comments on coldstore's patches:

(1) the idea is more than sound; we need to check if it
doesn't break common extensions that include tclInt.h (itcl
uses Proc, IIRC).

(2) a Proc has to know its namespace in order to 
(a) cause the body to be compiled in the correct namespace
(b) push a CallFrame for the correct namespace before
eval'ing the body
msoferplain2006-01-19 05:46:11
Logged In: YES 
user_id=148712

Updated apply4.patch, with fixes for two bugs noticed by dgp
on tclcore:
* [info level 0] now returns the full command line
* error messages do not refer to "procedures"

Still missing:
* TESTS!!
* move ::apply to ::tcl::apply (?)
* implement suggestion by jenglish (?): if the first
argument to apply is a single-element list, interpret it as
a command name instead

Coldstore's suggestion (improved) will appear in a
forthcoming patch that replaces 'struct Proc' with 'struct
Lambda', and arranges for proc to create a command that runs
a lambda (instead of apply running a nameless proc, as in
this patch). This cleaner approach will break compat with
(at least) itcl sources: investigating an approach that
avoids that.
msoferplain2006-01-19 05:46:16
File Added - 163955: apply4.patch
msoferplain2006-01-22 09:02:03
Logged In: YES 
user_id=148712

Patch apply4 was buggy-as-hell, sorry. The new apply5 should
be much better. Added a testfile too.
msoferplain2006-01-22 09:02:07
File Added - 164357: apply5.patch
msoferplain2006-01-22 09:03:34
File Added - 164358: apply.test
dgpplain2006-02-02 02:12:11
File Added - 165824: 944803.patch

Logged In: YES 
user_id=80530


New patch includes all changes
in one (including new files)
dgpplain2006-02-02 02:26:51
Logged In: YES 
user_id=80530

944803.patch committed for Tcl 8.5a4
Log in (anonymous is fine) to add a comment.

Attachments: