Artifact
31f0ffc941b461ba5603011c09831f647ba1daba:
Attachment "Tcl_TransferResult.TIP" to
ticket [1723738fff]
added by
eriklns
2007-08-29 02:26:33.
0000: 20 54 49 50 20 23 58 58 58 3a 20 4d 41 4b 45 20 TIP #XXX: MAKE
0010: 54 63 6c 54 72 61 6e 73 66 65 72 52 65 73 75 6c TclTransferResul
0020: 74 28 29 20 50 55 42 4c 49 43 0a 3d 3d 3d 3d 3d t() PUBLIC.=====
0030: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0040: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ================
0050: 3d 3d 3d 3d 3d 0a 20 56 65 72 73 69 6f 6e 3a 20 =====. Version:
0060: 20 20 20 20 20 24 52 65 76 69 73 69 6f 6e 3a 20 $Revision:
0070: 24 0a 20 41 75 74 68 6f 72 3a 20 20 20 20 20 20 $. Author:
0080: 20 45 72 69 6b 20 4c 65 75 6e 69 73 73 65 6e 20 Erik Leunissen
0090: 3c 65 2e 6c 65 75 6e 69 73 73 65 6e 5f 61 74 5f <e.leunissen_at_
00a0: 68 63 63 6e 65 74 2e 6e 6c 3e 0a 20 53 74 61 74 hccnet.nl>. Stat
00b0: 65 3a 20 20 20 20 20 20 20 20 44 72 61 66 74 0a e: Draft.
00c0: 20 54 79 70 65 3a 20 20 20 20 20 20 20 20 20 3f Type: ?
00d0: 3f 0a 20 54 63 6c 2d 56 65 72 73 69 6f 6e 3a 20 ?. Tcl-Version:
00e0: 20 3f 3f 0a 20 56 6f 74 65 3a 20 20 20 20 20 20 ??. Vote:
00f0: 20 20 20 0a 20 43 72 65 61 74 65 64 3a 20 20 20 . Created:
0100: 20 20 20 53 65 70 74 65 6d 62 65 72 20 32 30 30 September 200
0110: 37 0a 20 55 52 4c 3a 20 20 20 20 20 20 20 20 20 7. URL:
0120: 20 68 74 74 70 3a 2f 2f 77 77 77 2e 74 63 6c 2e http://www.tcl.
0130: 74 6b 2f 63 67 69 2d 62 69 6e 2f 74 63 74 2f 74 tk/cgi-bin/tct/t
0140: 69 70 2f 58 58 58 2e 68 74 6d 6c 0a 20 50 6f 73 ip/XXX.html. Pos
0150: 74 2d 48 69 73 74 6f 72 79 3a 20 0a 0a 2d 2d 2d t-History: ..---
0160: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0170: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0180: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0190: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
01a0: 2d 2d 2d 2d 2d 2d 0a 0a 20 41 42 53 54 52 41 43 ------.. ABSTRAC
01b0: 54 20 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 54 68 T .==========.Th
01c0: 69 73 20 54 49 50 20 70 72 6f 70 6f 73 65 73 20 is TIP proposes
01d0: 74 6f 20 6d 61 6b 65 20 74 68 65 20 65 78 69 73 to make the exis
01e0: 74 69 6e 67 20 66 75 6e 63 74 69 6f 6e 20 54 63 ting function Tc
01f0: 6c 54 72 61 6e 73 66 65 72 52 65 73 75 6c 74 28 lTransferResult(
0200: 29 20 70 61 72 74 20 6f 66 20 74 68 65 20 70 75 ) part of the pu
0210: 62 6c 69 63 20 69 6e 74 65 72 66 61 63 65 2e 0a blic interface..
0220: 0a 0a 20 52 41 54 49 4f 4e 41 4c 45 20 0a 3d 3d .. RATIONALE .==
0230: 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 54 68 65 20 66 75 =========.The fu
0240: 6e 63 74 69 6f 6e 20 54 63 6c 54 72 61 6e 73 66 nction TclTransf
0250: 65 72 52 65 73 75 6c 74 28 29 20 69 73 20 75 73 erResult() is us
0260: 65 64 20 62 79 20 54 63 6c 20 69 6e 74 65 72 6e ed by Tcl intern
0270: 61 6c 6c 79 20 74 6f 20 74 72 61 6e 73 66 65 72 ally to transfer
0280: 20 74 68 65 20 69 6e 74 65 72 70 20 72 65 73 75 the interp resu
0290: 6c 74 20 61 6e 64 2f 6f 72 20 65 72 72 6f 72 20 lt and/or error
02a0: 69 6e 66 6f 20 62 65 74 77 65 65 6e 20 64 69 66 info between dif
02b0: 66 65 72 65 6e 74 20 54 63 6c 20 69 6e 74 65 72 ferent Tcl inter
02c0: 70 72 65 74 65 72 73 2e 20 42 65 73 69 64 65 73 preters. Besides
02d0: 20 69 74 73 20 75 73 65 20 69 6e 20 74 68 65 20 its use in the
02e0: 54 63 6c 20 73 6f 75 72 63 65 73 2c 20 61 70 70 Tcl sources, app
02f0: 6c 69 63 61 74 69 6f 6e 73 20 28 62 61 73 65 64 lications (based
0300: 20 6f 6e 20 74 68 65 20 54 63 6c 20 6c 69 62 72 on the Tcl libr
0310: 61 72 79 29 20 77 68 69 63 68 20 75 73 65 20 6d ary) which use m
0320: 75 6c 74 69 70 6c 65 20 69 6e 74 65 72 70 72 65 ultiple interpre
0330: 74 65 72 73 20 6d 61 79 20 68 61 76 65 20 61 20 ters may have a
0340: 6e 65 65 64 20 66 6f 72 20 74 68 69 73 20 66 75 need for this fu
0350: 6e 63 74 69 6f 6e 61 6c 69 74 79 20 61 73 20 77 nctionality as w
0360: 65 6c 6c 2e 20 48 6f 77 65 76 65 72 2c 20 70 72 ell. However, pr
0370: 6f 67 72 61 6d 6d 65 72 73 20 61 72 65 20 6c 69 ogrammers are li
0380: 6b 65 6c 79 20 74 6f 20 6f 76 65 72 6c 6f 6f 6b kely to overlook
0390: 20 74 68 65 20 65 78 69 73 74 69 6e 67 20 54 63 the existing Tc
03a0: 6c 54 72 61 6e 73 66 65 72 52 65 73 75 6c 74 28 lTransferResult(
03b0: 29 20 61 73 20 6c 6f 6e 67 20 61 73 20 74 68 65 ) as long as the
03c0: 20 66 75 6e 63 74 69 6f 6e 20 63 6f 6e 74 69 6e function contin
03d0: 75 65 73 20 74 6f 20 6c 65 61 64 20 69 74 73 20 ues to lead its
03e0: 6d 6f 72 65 20 6f 72 20 6c 65 73 73 20 68 69 64 more or less hid
03f0: 64 65 6e 20 65 78 69 73 74 65 6e 63 65 5b 2a 5d den existence[*]
0400: 2e 20 4d 61 6b 69 6e 67 20 74 68 65 20 66 75 6e . Making the fun
0410: 63 74 69 6f 6e 20 70 75 62 6c 69 63 20 69 73 20 ction public is
0420: 76 65 72 79 20 6d 75 63 68 20 61 20 6d 61 74 74 very much a matt
0430: 65 72 20 6f 66 20 63 6f 75 72 74 65 73 79 2f 67 er of courtesy/g
0440: 65 6e 65 72 6f 73 69 74 79 20 74 6f 20 70 72 6f enerosity to pro
0450: 67 72 61 6d 6d 65 72 73 20 74 68 61 74 20 75 73 grammers that us
0460: 65 20 74 68 65 20 54 63 6c 20 6c 69 62 72 61 72 e the Tcl librar
0470: 79 2e 20 49 74 20 61 6c 73 6f 20 73 65 65 6d 73 y. It also seems
0480: 20 74 6f 20 6d 61 6b 65 20 74 68 65 20 41 50 49 to make the API
0490: 27 73 20 66 6f 72 20 72 65 73 75 6c 74 20 61 6e 's for result an
04a0: 64 20 65 72 72 6f 72 20 68 61 6e 64 6c 69 6e 67 d error handling
04b0: 20 6d 6f 72 65 20 63 6f 6d 70 6c 65 74 65 2e 0a more complete..
04c0: 0a 5b 2a 5d 20 54 68 65 20 54 49 50 20 61 75 74 .[*] The TIP aut
04d0: 68 6f 72 20 64 69 73 63 6f 76 65 72 65 64 20 69 hor discovered i
04e0: 74 73 20 65 78 69 73 74 65 6e 63 65 20 6f 6e 6c ts existence onl
04f0: 79 20 61 66 74 65 72 20 62 75 67 73 20 69 6e 20 y after bugs in
0500: 68 69 73 20 6f 77 6e 20 63 6f 64 65 20 6c 65 64 his own code led
0510: 20 68 69 6d 20 74 6f 20 69 6e 73 70 65 63 74 20 him to inspect
0520: 68 6f 77 20 54 63 6c 20 69 6e 74 65 72 6e 61 6c how Tcl internal
0530: 6c 79 20 68 61 6e 64 6c 65 73 20 72 65 73 75 6c ly handles resul
0540: 74 20 61 6e 64 20 65 72 72 6f 72 20 69 6e 66 6f t and error info
0550: 20 62 65 74 77 65 65 6e 20 69 6e 74 65 72 70 72 between interpr
0560: 65 74 65 72 73 2e 0a 0a 0a 20 49 4d 50 4c 45 4d eters.... IMPLEM
0570: 45 4e 54 41 54 49 4f 4e 20 0a 3d 3d 3d 3d 3d 3d ENTATION .======
0580: 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 0a 54 68 65 72 65 ==========.There
0590: 20 69 73 20 6e 6f 74 20 6d 75 63 68 20 74 6f 20 is not much to
05a0: 69 6d 70 6c 65 6d 65 6e 74 3a 20 54 63 6c 54 72 implement: TclTr
05b0: 61 6e 73 66 65 72 52 65 73 75 6c 74 28 29 20 61 ansferResult() a
05c0: 6c 72 65 61 64 79 20 65 78 69 73 74 73 20 69 6e lready exists in
05d0: 20 74 63 6c 52 65 73 75 6c 74 2e 63 2e 0a 57 68 tclResult.c..Wh
05e0: 61 74 20 72 65 6d 61 69 6e 73 20 74 6f 20 62 65 at remains to be
05f0: 20 64 6f 6e 65 3a 0a 0a 2a 20 72 65 6e 61 6d 69 done:..* renami
0600: 6e 67 20 74 6f 20 54 63 6c 5f 54 72 61 6e 66 65 ng to Tcl_Tranfe
0610: 72 52 65 73 75 6c 74 28 29 3a 20 69 2e 65 2e 20 rResult(): i.e.
0620: 69 6e 73 65 72 74 20 61 20 73 69 6e 67 6c 65 20 insert a single
0630: 75 6e 64 65 72 73 63 6f 72 65 20 63 68 61 72 61 underscore chara
0640: 63 74 65 72 20 69 6e 20 69 74 73 20 6e 61 6d 65 cter in its name
0650: 2e 20 54 68 65 20 66 75 6e 63 74 69 6f 6e 20 69 . The function i
0660: 73 20 6e 6f 74 20 64 65 63 6c 61 72 65 64 20 73 s not declared s
0670: 74 61 74 69 63 20 61 6c 72 65 61 64 79 2e 0a 0a tatic already...
0680: 2a 20 73 6c 6f 74 20 69 74 20 69 6e 74 6f 20 74 * slot it into t
0690: 68 65 20 54 63 6c 20 73 74 75 62 73 20 74 61 62 he Tcl stubs tab
06a0: 6c 65 2e 0a 0a 2a 20 77 72 69 74 65 20 64 6f 63 le...* write doc
06b0: 75 6d 65 6e 74 61 74 69 6f 6e 0a 41 20 64 72 61 umentation.A dra
06c0: 66 74 20 76 65 72 73 69 6f 6e 20 6f 66 20 74 68 ft version of th
06d0: 65 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 20 e documentation
06e0: 68 61 73 20 61 6c 72 65 61 64 79 20 62 65 65 6e has already been
06f0: 20 73 75 70 70 6c 69 65 64 20 61 73 20 61 20 73 supplied as a s
0700: 65 70 61 72 61 74 65 20 66 69 6c 65 20 54 63 6c eparate file Tcl
0710: 5f 54 72 61 6e 73 66 65 72 52 65 73 75 6c 74 2e _TransferResult.
0720: 72 65 66 20 49 74 20 68 61 73 20 62 65 65 6e 20 ref It has been
0730: 77 72 69 74 74 65 6e 20 61 73 20 61 6e 20 61 64 written as an ad
0740: 64 69 74 69 6f 6e 20 74 6f 20 61 6e 20 65 78 69 dition to an exi
0750: 73 74 69 6e 67 20 6d 61 6e 20 70 61 67 65 2e 20 sting man page.
0760: 54 68 65 20 71 75 65 73 74 69 6f 6e 20 72 65 6d The question rem
0770: 61 69 6e 73 20 77 68 69 63 68 20 69 73 20 74 68 ains which is th
0780: 65 20 6d 6f 73 74 20 61 70 70 72 6f 70 72 69 61 e most appropria
0790: 74 65 20 6d 61 6e 75 61 6c 20 70 61 67 65 20 74 te manual page t
07a0: 6f 20 61 64 64 20 69 74 20 74 6f 2e 0a 0a 43 6f o add it to...Co
07b0: 6e 73 69 64 65 72 61 74 69 6f 6e 73 20 66 6f 72 nsiderations for
07c0: 20 70 6c 61 63 65 6d 65 6e 74 20 6f 66 20 74 68 placement of th
07d0: 65 20 64 6f 63 75 6d 65 6e 74 61 74 69 6f 6e 3a e documentation:
07e0: 0a 2d 20 6d 61 6e 20 70 61 67 65 20 66 6f 72 20 .- man page for
07f0: 54 63 6c 5f 43 72 65 61 74 65 49 6e 74 65 72 70 Tcl_CreateInterp
0800: 3a 20 74 68 69 73 20 69 73 20 74 68 65 20 6f 6e : this is the on
0810: 6c 79 20 6d 61 6e 75 61 6c 20 70 61 67 65 20 74 ly manual page t
0820: 68 61 74 20 69 73 20 73 6f 6c 65 6c 79 20 69 6e hat is solely in
0830: 74 65 6e 64 65 64 20 66 6f 72 20 6d 75 6c 74 69 tended for multi
0840: 70 6c 65 20 69 6e 74 65 72 70 72 65 74 65 72 73 ple interpreters
0850: 20 77 68 69 63 68 20 61 72 65 20 74 72 75 6c 79 which are truly
0860: 20 61 72 62 69 74 72 61 72 79 20 69 6e 74 65 72 arbitrary inter
0870: 70 72 65 74 65 72 73 2c 20 69 2e 65 2e 20 77 69 preters, i.e. wi
0880: 74 68 6f 75 74 20 61 6e 79 20 69 6d 70 6f 73 65 thout any impose
0890: 64 20 72 65 6c 61 74 69 6f 6e 73 68 69 70 20 62 d relationship b
08a0: 65 74 77 65 65 6e 20 74 68 65 6d 2e 20 48 6f 77 etween them. How
08b0: 65 76 65 72 2c 20 69 74 20 64 6f 65 73 6e 27 74 ever, it doesn't
08c0: 20 63 6f 6e 63 65 72 6e 20 69 6e 74 65 72 70 20 concern interp
08d0: 72 65 73 75 6c 74 73 2e 0a 2d 20 6d 61 6e 20 70 results..- man p
08e0: 61 67 65 20 66 6f 72 20 54 63 6c 5f 43 72 65 61 age for Tcl_Crea
08f0: 74 65 53 6c 61 76 65 3a 20 74 68 69 73 20 6d 61 teSlave: this ma
0900: 6e 75 61 6c 20 70 61 67 65 20 73 61 79 73 20 66 nual page says f
0910: 6f 72 20 69 74 73 65 6c 66 20 74 68 61 74 20 69 or itself that i
0920: 74 20 63 6f 6e 63 65 72 6e 73 20 6d 75 6c 74 69 t concerns multi
0930: 70 6c 65 20 69 6e 74 65 72 70 72 65 74 65 72 73 ple interpreters
0940: 2c 20 77 68 69 63 68 20 69 73 20 6f 6e 6c 79 20 , which is only
0950: 68 61 6c 66 20 74 68 65 20 74 72 75 74 68 3a 20 half the truth:
0960: 69 74 20 63 6f 6e 63 65 72 6e 73 20 6d 6f 73 74 it concerns most
0970: 6c 79 20 69 6e 74 65 72 70 72 65 74 65 72 73 20 ly interpreters
0980: 74 68 61 74 20 68 61 76 65 20 61 6e 20 65 78 70 that have an exp
0990: 6c 69 63 69 74 20 6d 61 73 74 65 72 2d 73 6c 61 licit master-sla
09a0: 76 65 20 72 65 6c 61 74 69 6f 6e 73 68 69 70 2c ve relationship,
09b0: 20 74 68 65 20 6f 6e 6c 79 20 65 78 63 65 70 74 the only except
09c0: 69 6f 6e 20 62 65 69 6e 67 20 54 63 6c 5f 43 72 ion being Tcl_Cr
09d0: 65 61 74 65 41 6c 69 61 73 28 4f 62 6a 29 2e 0a eateAlias(Obj)..
09e0: 2d 20 6d 61 6e 20 70 61 67 65 20 66 6f 72 20 54 - man page for T
09f0: 63 6c 5f 53 61 76 65 52 65 73 75 6c 74 3a 20 68 cl_SaveResult: h
0a00: 61 6e 64 6c 65 73 20 69 6e 74 65 72 70 20 72 65 andles interp re
0a10: 73 75 6c 74 73 20 28 62 75 74 20 69 73 20 6e 6f sults (but is no
0a20: 74 20 61 74 20 61 6c 6c 20 69 6e 74 65 6e 64 65 t at all intende
0a30: 64 20 66 6f 72 20 6d 75 6c 74 69 70 6c 65 20 69 d for multiple i
0a40: 6e 74 65 72 70 72 65 74 65 72 20 73 69 74 75 61 nterpreter situa
0a50: 74 69 6f 6e 73 29 0a 0a 0a 20 43 4f 50 59 52 49 tions)... COPYRI
0a60: 47 48 54 20 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d GHT .===========
0a70: 0a 20 54 68 69 73 20 64 6f 63 75 6d 65 6e 74 20 . This document
0a80: 68 61 73 20 62 65 65 6e 20 70 6c 61 63 65 64 20 has been placed
0a90: 69 6e 20 74 68 65 20 70 75 62 6c 69 63 20 64 6f in the public do
0aa0: 6d 61 69 6e 2e 20 0a 0a 2d 2d 2d 2d 2d 2d 2d 2d main. ..--------
0ab0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0ac0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0ad0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0ae0: 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d ----------------
0af0: 2d 0a 0a 20 54 49 50 20 41 75 74 6f 47 65 6e 65 -.. TIP AutoGene
0b00: 72 61 74 6f 72 20 2d 20 77 72 69 74 74 65 6e 20 rator - written
0b10: 62 79 20 44 6f 6e 61 6c 20 4b 2e 20 46 65 6c 6c by Donal K. Fell
0b20: 6f 77 73 20 0a ows .