home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / lisp / stk-3.002 / stk-3 / STk-3.1 / Doc / Tcl93 / Tcl93.tex < prev   
LaTeX Document  |  1993-12-06  |  20.6 KB

open in: MacOS 8.1     |     Win98     |     DOS

view JSON data     |     view as text

This file was processed as: LaTeX Document (document/latex).

You can browse this item here: Tcl93.tex

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
100% dexvert Texinfo Document (document/texInfo) magic Supported
1% dexvert Corel 10 Texture (image/corel10Texture) ext Unsupported
1% dexvert Croteam texture file (image/croteamTextureFile) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX document text default
99% file TeX document text default
98% file LaTeX document, ASCII text default
100% TrID LaTeX 2e document (with rem) default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% siegfried fmt/281 LaTeX (Subdocument) default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime text/x-matlab default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 0a 25 20 54 63 6c 2d | 39 33 20 50 72 65 73 65 |%.% Tcl-|93 Prese|
|00000010| 6e 74 61 74 69 6f 6e 20 | 6f 66 20 53 74 6b 0a 25 |ntation |of Stk.%|
|00000020| 0a 25 20 20 20 20 20 20 | 20 20 20 20 20 41 75 74 |.% | Aut|
|00000030| 68 6f 72 3a 20 45 72 69 | 63 6b 20 47 61 6c 6c 65 |hor: Eri|ck Galle|
|00000040| 73 69 6f 20 5b 65 67 40 | 6b 61 6f 6c 69 6e 2e 75 |sio [eg@|kaolin.u|
|00000050| 6e 69 63 65 2e 66 72 5d | 0a 25 20 20 20 20 43 72 |nice.fr]|.% Cr|
|00000060| 65 61 74 69 6f 6e 20 64 | 61 74 65 3a 20 20 35 2d |eation d|ate: 5-|
|00000070| 41 70 72 2d 31 39 39 33 | 20 31 32 3a 32 39 0a 25 |Apr-1993| 12:29.%|
|00000080| 20 4c 61 73 74 20 66 69 | 6c 65 20 75 70 64 61 74 | Last fi|le updat|
|00000090| 65 3a 20 32 34 2d 4d 61 | 79 2d 31 39 39 33 20 32 |e: 24-Ma|y-1993 2|
|000000a0| 32 3a 31 32 0a 0a 0a 5c | 64 6f 63 75 6d 65 6e 74 |2:12...\|document|
|000000b0| 73 74 79 6c 65 5b 74 77 | 6f 63 6f 6c 75 6d 6e 2c |style[tw|ocolumn,|
|000000c0| 74 63 6c 5d 7b 61 72 74 | 69 63 6c 65 7d 0a 5c 69 |tcl]{art|icle}.\i|
|000000d0| 6e 70 75 74 7b 70 73 66 | 69 67 7d 0a 5c 62 65 67 |nput{psf|ig}.\beg|
|000000e0| 69 6e 7b 64 6f 63 75 6d | 65 6e 74 7d 0a 5c 62 69 |in{docum|ent}.\bi|
|000000f0| 62 6c 69 6f 67 72 61 70 | 68 79 73 74 79 6c 65 7b |bliograp|hystyle{|
|00000100| 75 6e 73 72 74 7d 0a 0a | 25 0a 25 20 43 6f 6d 6d |unsrt}..|%.% Comm|
|00000110| 61 6e 64 73 0a 25 20 0a | 0a 5c 6e 65 77 63 6f 6d |ands.% .|.\newcom|
|00000120| 6d 61 6e 64 7b 5c 73 74 | 6b 7d 7b 7b 5c 73 63 20 |mand{\st|k}{{\sc |
|00000130| 53 54 6b 20 7d 7d 0a 5c | 74 69 74 6c 65 7b 45 6d |STk }}.\|title{Em|
|00000140| 62 65 64 64 69 6e 67 20 | 61 20 53 63 68 65 6d 65 |bedding |a Scheme|
|00000150| 20 49 6e 74 65 72 70 72 | 65 74 65 72 20 69 6e 20 | Interpr|eter in |
|00000160| 74 68 65 20 54 6b 20 54 | 6f 6f 6c 6b 69 74 7d 0a |the Tk T|oolkit}.|
|00000170| 7b 5c 66 6f 6f 74 6e 6f | 74 65 73 69 7a 65 0a 5c |{\footno|tesize.\|
|00000180| 61 75 74 68 6f 72 7b 0a | 45 72 69 63 6b 20 47 61 |author{.|Erick Ga|
|00000190| 6c 6c 65 73 69 6f 20 5c | 5c 0a 55 6e 69 76 65 72 |llesio \|\.Univer|
|000001a0| 73 69 74 5c 27 65 20 64 | 65 20 4e 69 63 65 7e 7e |sit\'e d|e Nice~~|
|000001b0| 2d 7e 7e 53 6f 70 68 69 | 61 2d 41 6e 74 69 70 6f |-~~Sophi|a-Antipo|
|000001c0| 6c 69 73 20 5c 5c 0a 4c | 61 62 6f 72 61 74 6f 69 |lis \\.L|aboratoi|
|000001d0| 72 65 20 49 33 53 20 2d | 20 43 4e 52 53 20 55 52 |re I3S -| CNRS UR|
|000001e0| 41 20 31 33 37 36 20 2d | 20 42 5c 5e 61 74 20 34 |A 1376 -| B\^at 4|
|000001f0| 2e 20 5c 5c 0a 32 35 30 | 2c 20 61 76 65 6e 75 65 |. \\.250|, avenue|
|00000200| 20 41 6c 62 65 72 74 20 | 45 69 6e 73 74 65 69 6e | Albert |Einstein|
|00000210| 20 5c 5c 0a 53 6f 70 68 | 69 61 20 41 6e 74 69 70 | \\.Soph|ia Antip|
|00000220| 6f 6c 69 73 20 5c 5c 0a | 30 36 35 36 30 20 56 61 |olis \\.|06560 Va|
|00000230| 6c 62 6f 6e 6e 65 20 2d | 20 46 52 41 4e 43 45 7d |lbonne -| FRANCE}|
|00000240| 7d 0a 5c 64 61 74 65 7b | 7d 0a 5c 6d 61 6b 65 74 |}.\date{|}.\maket|
|00000250| 69 74 6c 65 0a 5c 76 73 | 6b 69 70 31 63 6d 0a 5c |itle.\vs|kip1cm.\|
|00000260| 62 65 67 69 6e 7b 61 62 | 73 74 72 61 63 74 7d 0a |begin{ab|stract}.|
|00000270| 7b 5c 69 74 20 5c 73 74 | 6b 20 69 73 20 61 20 67 |{\it \st|k is a g|
|00000280| 72 61 70 68 69 63 61 6c | 20 70 61 63 6b 61 67 65 |raphical| package|
|00000290| 20 77 68 69 63 68 20 72 | 65 6c 79 20 6f 6e 20 54 | which r|ely on T|
|000002a0| 6b 20 61 6e 64 20 74 68 | 65 20 53 63 68 65 6d 65 |k and th|e Scheme|
|000002b0| 20 70 72 6f 67 72 61 6d | 6d 69 6e 67 0a 6c 61 6e | program|ming.lan|
|000002c0| 67 75 61 67 65 2e 20 43 | 6f 6e 63 72 65 74 65 6c |guage. C|oncretel|
|000002d0| 79 2c 20 69 74 20 63 61 | 6e 20 62 65 20 73 65 65 |y, it ca|n be see|
|000002e0| 6e 20 61 73 20 74 68 65 | 20 54 6b 20 70 61 63 6b |n as the| Tk pack|
|000002f0| 61 67 65 20 77 68 65 72 | 65 20 74 68 65 0a 54 63 |age wher|e the.Tc|
|00000300| 6c 20 6c 61 6e 67 75 61 | 67 65 20 61 73 20 62 65 |l langua|ge as be|
|00000310| 65 6e 20 7b 5c 65 6d 20 | 72 65 70 6c 61 63 65 64 |en {\em |replaced|
|00000320| 7d 20 62 79 20 61 20 53 | 63 68 65 6d 65 20 69 6e |} by a S|cheme in|
|00000330| 74 65 72 70 72 65 74 65 | 72 2e 20 20 50 72 6f 67 |terprete|r. Prog|
|00000340| 72 61 6d 6d 69 6e 67 20 | 77 69 74 68 0a 7b 5c 73 |ramming |with.{\s|
|00000350| 74 6b 7d 20 63 61 6e 20 | 62 65 20 64 6f 6e 65 20 |tk} can |be done |
|00000360| 61 74 20 74 77 6f 20 64 | 69 73 74 69 6e 63 74 20 |at two d|istinct |
|00000370| 6c 65 76 65 6c 73 2e 20 | 46 69 72 73 74 20 6c 65 |levels. |First le|
|00000380| 76 65 6c 20 69 73 20 71 | 75 69 74 65 20 69 64 65 |vel is q|uite ide|
|00000390| 6e 74 69 63 61 6c 20 74 | 68 61 6e 0a 70 72 6f 67 |ntical t|han.prog|
|000003a0| 72 61 6d 6d 69 6e 67 20 | 54 6b 20 77 69 74 68 20 |ramming |Tk with |
|000003b0| 54 63 6c 2e 20 53 65 63 | 6f 6e 64 20 6c 65 76 65 |Tcl. Sec|ond leve|
|000003c0| 6c 20 6f 66 20 70 72 6f | 67 72 61 6d 6d 69 6e 67 |l of pro|gramming|
|000003d0| 20 75 73 65 73 20 61 20 | 66 75 6c 6c 20 6f 62 6a | uses a |full obj|
|000003e0| 65 63 74 0a 6f 72 69 65 | 6e 74 65 64 20 73 79 73 |ect.orie|nted sys|
|000003f0| 74 65 6d 2e 20 54 68 6f | 73 65 20 74 77 6f 20 70 |tem. Tho|se two p|
|00000400| 72 6f 67 72 61 6d 6d 69 | 6e 67 20 6c 65 76 65 6c |rogrammi|ng level|
|00000410| 73 20 61 6e 64 20 63 75 | 72 72 65 6e 74 20 69 6d |s and cu|rrent im|
|00000420| 70 6c 65 6d 65 6e 74 61 | 74 69 6f 6e 20 61 72 65 |plementa|tion are|
|00000430| 0a 64 65 73 63 72 69 62 | 65 64 20 68 65 72 65 2e |.describ|ed here.|
|00000440| 7d 0a 5c 65 6e 64 7b 61 | 62 73 74 72 61 63 74 7d |}.\end{a|bstract}|
|00000450| 0a 0a 0a 5c 73 65 63 74 | 69 6f 6e 7b 49 6e 74 72 |...\sect|ion{Intr|
|00000460| 6f 64 75 63 74 69 6f 6e | 7d 0a 54 6f 64 61 79 27 |oduction|}.Today'|
|00000470| 73 20 61 76 61 69 6c 61 | 62 6c 65 20 67 72 61 70 |s availa|ble grap|
|00000480| 68 69 63 61 6c 20 74 6f | 6f 6c 6b 69 74 73 20 66 |hical to|olkits f|
|00000490| 6f 72 20 61 70 70 6c 69 | 63 61 74 69 76 65 20 6c |or appli|cative l|
|000004a0| 61 6e 67 75 61 67 65 73 | 20 61 72 65 20 6e 6f 74 |anguages| are not|
|000004b0| 0a 73 61 74 69 73 66 61 | 63 74 6f 72 79 2e 20 4d |.satisfa|ctory. M|
|000004c0| 6f 73 74 20 6f 66 20 74 | 68 65 20 74 69 6d 65 2c |ost of t|he time,|
|000004d0| 20 74 68 65 79 20 61 73 | 6b 20 74 6f 20 74 68 65 | they as|k to the|
|000004e0| 20 75 73 65 72 20 74 6f | 20 62 65 20 61 6e 20 58 | user to| be an X|
|000004f0| 20 65 78 70 65 72 74 20 | 77 68 69 63 68 0a 6d 75 | expert |which.mu|
|00000500| 73 74 20 63 6f 70 65 20 | 77 69 74 68 20 63 6f 6d |st cope |with com|
|00000510| 70 6c 69 63 61 74 65 64 | 20 61 72 63 61 6e 65 20 |plicated| arcane |
|00000520| 64 65 74 61 69 6c 73 20 | 73 75 63 68 20 61 73 20 |details |such as |
|00000530| 73 65 72 76 65 72 20 63 | 6f 6e 6e 65 63 74 69 6f |server c|onnectio|
|00000540| 6e 73 20 6f 72 20 71 75 | 65 75 65 0a 65 76 65 6e |ns or qu|eue.even|
|00000550| 74 73 2e 20 20 54 68 69 | 73 20 69 73 20 61 20 74 |ts. Thi|s is a t|
|00000560| 72 75 65 20 70 72 6f 62 | 6c 65 6d 2c 20 73 69 6e |rue prob|lem, sin|
|00000570| 63 65 20 70 65 6f 70 6c | 65 20 77 68 69 63 68 20 |ce peopl|e which |
|00000580| 75 73 65 20 74 68 69 73 | 20 6b 69 6e 64 20 6f 66 |use this| kind of|
|00000590| 20 6c 61 6e 67 75 61 67 | 65 73 0a 61 72 65 20 67 | languag|es.are g|
|000005a0| 65 6e 65 72 61 6c 6c 79 | 20 6e 6f 74 20 69 6e 63 |enerally| not inc|
|000005b0| 6c 69 6e 65 64 20 69 6e | 20 73 79 73 74 65 6d 20 |lined in| system |
|000005c0| 70 72 6f 67 72 61 6d 6d | 69 6e 67 20 61 6e 64 20 |programm|ing and |
|000005d0| 6c 69 74 74 6c 65 20 6f | 66 20 74 68 65 6d 20 67 |little o|f them g|
|000005e0| 65 74 20 6f 76 65 72 0a | 74 68 65 20 67 61 70 20 |et over.|the gap |
|000005f0| 62 65 74 77 65 65 6e 20 | 74 68 65 20 6c 61 6e 67 |between |the lang|
|00000600| 75 61 67 65 20 61 6e 64 | 20 74 68 65 20 74 6f 6f |uage and| the too|
|00000610| 6c 6b 69 74 20 61 62 73 | 74 72 61 63 74 69 6f 6e |lkit abs|traction|
|00000620| 20 6c 65 76 65 6c 73 2e | 0a 0a 54 6b 20 69 73 20 | levels.|..Tk is |
|00000630| 61 20 70 6f 77 65 72 66 | 75 6c 20 58 31 31 20 67 |a powerf|ul X11 g|
|00000640| 72 61 70 68 69 63 61 6c | 20 74 6f 6f 6c 5c 2d 6b |raphical| tool\-k|
|00000650| 69 74 20 64 65 5c 2d 66 | 69 5c 2d 6e 65 64 20 61 |it de\-f|i\-ned a|
|00000660| 74 20 74 68 65 20 55 6e | 69 76 65 72 73 69 74 79 |t the Un|iversity|
|00000670| 20 6f 66 20 42 65 72 6b | 65 6c 65 79 0a 62 79 20 | of Berk|eley.by |
|00000680| 4a 2e 4f 75 73 74 65 72 | 68 6f 75 74 20 5c 63 69 |J.Ouster|hout \ci|
|00000690| 74 65 7b 4f 75 73 74 65 | 72 2d 54 6b 7d 2e 20 54 |te{Ouste|r-Tk}. T|
|000006a0| 68 69 73 20 74 6f 6f 6c | 6b 69 74 20 67 69 76 65 |his tool|kit give|
|000006b0| 73 20 74 6f 20 74 68 65 | 20 75 73 65 72 20 68 69 |s to the| user hi|
|000006c0| 67 68 20 6c 65 76 65 6c | 0a 77 69 64 67 65 74 73 |gh level|.widgets|
|000006d0| 20 73 75 63 68 20 61 73 | 20 62 75 74 74 6f 6e 73 | such as| buttons|
|000006e0| 20 6f 72 20 6d 65 6e 75 | 20 61 6e 64 20 69 73 20 | or menu| and is |
|000006f0| 65 61 73 69 6c 79 20 70 | 72 6f 67 72 61 6d 6d 61 |easily p|rogramma|
|00000700| 62 6c 65 2e 20 49 6e 20 | 70 61 72 74 69 63 75 6c |ble. In |particul|
|00000710| 61 72 2c 20 61 0a 6c 69 | 74 74 6c 65 20 6b 6e 6f |ar, a.li|ttle kno|
|00000720| 77 6c 65 64 67 65 20 6f | 66 20 58 20 66 75 6e 64 |wledge o|f X fund|
|00000730| 61 6d 65 6e 74 61 6c 73 | 20 61 72 65 20 6e 65 65 |amentals| are nee|
|00000740| 64 65 64 20 74 6f 20 62 | 75 69 6c 64 20 61 6e 20 |ded to b|uild an |
|00000750| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 77 69 74 68 |applicat|ion with|
|00000760| 20 69 74 2e 0a 54 6b 20 | 70 61 63 6b 61 67 65 20 | it..Tk |package |
|00000770| 72 65 6c 79 20 6f 6e 20 | 61 6e 20 69 6e 74 65 72 |rely on |an inter|
|00000780| 70 72 65 74 61 74 69 76 | 65 20 6c 61 6e 67 75 61 |pretativ|e langua|
|00000790| 67 65 20 6e 61 6d 65 64 | 20 54 63 6c 20 5c 63 69 |ge named| Tcl \ci|
|000007a0| 74 65 7b 4f 75 73 74 65 | 72 2d 54 63 6c 7d 2e 0a |te{Ouste|r-Tcl}..|
|000007b0| 48 6f 77 65 76 65 72 2c | 20 64 65 70 65 6e 64 65 |However,| depende|
|000007c0| 6e 63 69 65 73 20 62 65 | 74 77 65 65 6e 20 74 68 |ncies be|tween th|
|000007d0| 6f 73 65 20 74 77 6f 20 | 70 61 63 6b 61 67 65 73 |ose two |packages|
|000007e0| 20 61 72 65 20 6e 6f 74 | 20 74 6f 6f 20 69 6e 74 | are not| too int|
|000007f0| 72 69 63 61 74 65 20 61 | 6e 64 0a 72 65 70 6c 61 |ricate a|nd.repla|
|00000800| 63 69 6e 67 20 54 63 6c | 20 62 79 20 61 6e 20 61 |cing Tcl| by an a|
|00000810| 70 70 6c 69 63 61 74 69 | 76 65 20 6c 61 6e 67 75 |pplicati|ve langu|
|00000820| 61 67 65 20 77 61 73 20 | 61 6e 20 65 78 63 69 74 |age was |an excit|
|00000830| 69 6e 67 20 63 68 61 6c | 6c 65 6e 67 65 2e 20 54 |ing chal|lenge. T|
|00000840| 6f 20 6b 65 65 70 0a 69 | 6e 74 61 63 74 20 74 68 |o keep.i|ntact th|
|00000850| 65 20 54 6b 2f 54 63 6c | 20 70 61 69 72 20 73 70 |e Tk/Tcl| pair sp|
|00000860| 69 72 69 74 2c 20 61 20 | 6c 69 74 74 6c 65 20 61 |irit, a |little a|
|00000870| 70 70 6c 69 63 61 74 69 | 76 65 20 6c 61 6e 67 75 |pplicati|ve langu|
|00000880| 61 67 65 20 77 61 73 20 | 6e 65 63 65 73 73 61 72 |age was |necessar|
|00000890| 79 2e 0a 53 63 68 65 6d | 65 20 5c 63 69 74 65 7b |y..Schem|e \cite{|
|000008a0| 53 49 43 50 7d 20 77 61 | 73 20 61 20 67 6f 6f 64 |SICP} wa|s a good|
|000008b0| 20 63 61 6e 64 69 64 61 | 74 65 20 74 6f 20 72 65 | candida|te to re|
|000008c0| 70 6c 61 63 65 20 54 63 | 6c 2c 20 62 65 63 61 75 |place Tc|l, becau|
|000008d0| 73 65 20 69 74 20 69 73 | 20 73 6d 61 6c 6c 2c 0a |se it is| small,.|
|000008e0| 63 6c 65 61 6e 20 61 6e | 64 20 77 65 6c 6c 20 64 |clean an|d well d|
|000008f0| 65 66 69 6e 65 64 20 73 | 69 6e 63 65 20 69 74 20 |efined s|ince it |
|00000900| 69 73 20 61 6e 20 49 45 | 45 45 20 73 74 61 6e 64 |is an IE|EE stand|
|00000910| 61 72 64 0a 5c 63 69 74 | 65 7b 49 45 45 45 2d 53 |ard.\cit|e{IEEE-S|
|00000920| 63 68 65 6d 65 7d 2e 20 | 0a 0a 50 72 6f 67 72 61 |cheme}. |..Progra|
|00000930| 6d 6d 69 6e 67 20 77 69 | 74 68 20 7b 5c 73 74 6b |mming wi|th {\stk|
|00000940| 7d 20 63 61 6e 20 62 65 | 20 64 6f 6e 65 20 61 74 |} can be| done at|
|00000950| 20 74 77 6f 20 64 69 73 | 74 69 6e 63 74 20 6c 65 | two dis|tinct le|
|00000960| 76 65 6c 73 2e 20 46 69 | 72 73 74 20 6c 65 76 65 |vels. Fi|rst leve|
|00000970| 6c 20 69 73 0a 71 75 69 | 74 65 20 69 64 65 6e 74 |l is.qui|te ident|
|00000980| 69 63 61 6c 20 74 68 61 | 6e 20 70 72 6f 67 72 61 |ical tha|n progra|
|00000990| 6d 6d 69 6e 67 20 54 6b | 20 77 69 74 68 20 54 63 |mming Tk| with Tc|
|000009a0| 6c 2c 20 65 78 63 65 70 | 74 69 6e 67 20 73 65 76 |l, excep|ting sev|
|000009b0| 65 72 61 6c 20 6d 69 6e | 6f 72 0a 73 79 6e 74 61 |eral min|or.synta|
|000009c0| 63 74 69 63 20 64 69 66 | 66 65 72 65 6e 63 65 73 |ctic dif|ferences|
|000009d0| 2e 20 53 65 63 6f 6e 64 | 20 6c 65 76 65 6c 20 6f |. Second| level o|
|000009e0| 66 20 70 72 6f 67 72 61 | 6d 6d 69 6e 67 20 75 73 |f progra|mming us|
|000009f0| 65 73 20 61 20 66 75 6c | 6c 20 6f 62 6a 65 63 74 |es a ful|l object|
|00000a00| 20 6f 72 69 65 6e 74 65 | 64 0a 73 79 73 74 65 6d | oriente|d.system|
|00000a10| 20 28 77 69 74 68 20 6d | 75 6c 74 69 2d 69 6e 68 | (with m|ulti-inh|
|00000a20| 65 72 69 74 61 6e 63 65 | 2c 20 67 65 6e 65 72 69 |eritance|, generi|
|00000a30| 63 20 66 75 6e 63 74 69 | 6f 6e 73 20 61 6e 64 20 |c functi|ons and |
|00000a40| 61 20 74 72 75 65 20 6d | 65 74 61 20 6f 62 6a 65 |a true m|eta obje|
|00000a50| 63 74 0a 70 72 6f 74 6f | 63 6f 6c 29 2e 20 54 68 |ct.proto|col). Th|
|00000a60| 6f 73 65 20 74 77 6f 20 | 6c 65 76 65 6c 73 20 6f |ose two |levels o|
|00000a70| 66 20 70 72 6f 67 72 61 | 6d 6d 69 6e 67 20 61 72 |f progra|mming ar|
|00000a80| 65 20 62 72 69 65 66 6c | 79 20 64 65 73 63 72 69 |e briefl|y descri|
|00000a90| 62 65 64 20 69 6e 20 74 | 68 65 20 74 77 6f 20 66 |bed in t|he two f|
|00000aa0| 69 72 73 74 0a 73 65 63 | 74 69 6f 6e 73 2e 20 53 |irst.sec|tions. S|
|00000ab0| 65 63 74 69 6f 6e 20 34 | 20 69 73 20 64 65 76 6f |ection 4| is devo|
|00000ac0| 74 65 64 20 74 6f 20 69 | 6d 70 6c 65 6d 65 6e 74 |ted to i|mplement|
|00000ad0| 61 74 69 6f 6e 20 61 6e | 64 20 73 65 63 74 69 6f |ation an|d sectio|
|00000ae0| 6e 20 35 20 65 78 70 6f | 73 65 73 20 73 6f 6d 65 |n 5 expo|ses some|
|00000af0| 0a 65 6e 63 6f 75 6e 74 | 65 72 65 64 20 70 72 6f |.encount|ered pro|
|00000b00| 62 6c 65 6d 73 20 77 68 | 65 6e 20 6d 69 78 69 6e |blems wh|en mixin|
|00000b10| 67 20 54 6b 20 61 6e 64 | 20 53 63 68 65 6d 65 2e |g Tk and| Scheme.|
|00000b20| 0a 0a 5c 73 65 63 74 69 | 6f 6e 7b 5c 73 74 6b 3a |..\secti|on{\stk:|
|00000b30| 20 46 69 72 73 74 20 6c | 65 76 65 6c 7d 0a 0a 54 | First l|evel}..T|
|00000b40| 68 65 20 66 69 72 73 74 | 20 6c 65 76 65 6c 20 6f |he first| level o|
|00000b50| 66 20 7b 5c 73 74 6b 7d | 20 75 73 65 73 20 74 68 |f {\stk}| uses th|
|00000b60| 65 20 73 74 61 6e 64 61 | 72 64 20 53 63 68 65 6d |e standa|rd Schem|
|00000b70| 65 20 63 6f 6e 73 74 72 | 75 63 74 73 2e 20 54 6f |e constr|ucts. To|
|00000b80| 20 77 6f 72 6b 20 61 74 | 0a 74 68 69 73 20 6c 65 | work at|.this le|
|00000b90| 76 65 6c 2c 20 61 20 75 | 73 65 72 20 6d 75 73 74 |vel, a u|ser must|
|00000ba0| 20 6b 6e 6f 77 20 61 20 | 6c 69 74 74 6c 65 20 73 | know a |little s|
|00000bb0| 65 74 20 6f 66 20 72 65 | 77 72 69 74 69 6e 67 20 |et of re|writing |
|00000bc0| 72 75 6c 65 73 20 66 72 | 6f 6d 20 74 68 65 0a 6f |rules fr|om the.o|
|00000bd0| 72 69 67 69 6e 61 6c 20 | 54 6b 2d 54 63 6c 20 6c |riginal |Tk-Tcl l|
|00000be0| 69 62 72 61 72 79 2e 20 | 57 69 74 68 20 74 68 65 |ibrary. |With the|
|00000bf0| 73 65 20 72 75 6c 65 73 | 2c 20 74 68 65 20 54 6b |se rules|, the Tk|
|00000c00| 20 6d 61 6e 75 61 6c 20 | 70 61 67 65 73 20 61 6e | manual |pages an|
|00000c10| 64 20 61 20 6c 69 74 74 | 6c 65 0a 6b 6e 6f 77 6c |d a litt|le.knowl|
|00000c20| 65 64 67 65 20 6f 66 20 | 53 63 68 65 6d 65 2c 20 |edge of |Scheme, |
|00000c30| 68 65 2f 73 68 65 20 63 | 61 6e 20 65 61 73 69 6c |he/she c|an easil|
|00000c40| 79 20 62 75 69 6c 64 20 | 61 20 7b 5c 73 74 6b 7d |y build |a {\stk}|
|00000c50| 20 70 72 6f 67 72 61 6d | 2e 0a 0a 43 72 65 61 74 | program|...Creat|
|00000c60| 69 6f 6e 20 6f 66 20 61 | 20 6e 65 77 20 77 69 64 |ion of a| new wid|
|00000c70| 67 65 74 20 28 62 75 74 | 74 6f 6e 2c 20 6c 61 62 |get (but|ton, lab|
|00000c80| 65 6c 2c 20 63 61 6e 76 | 61 73 2c 20 2e 2e 2e 29 |el, canv|as, ...)|
|00000c90| 20 69 73 20 64 6f 6e 65 | 20 77 69 74 68 20 73 70 | is done| with sp|
|00000ca0| 65 63 69 61 6c 20 5c 73 | 74 6b 0a 70 72 69 6d 69 |ecial \s|tk.primi|
|00000cb0| 74 69 76 65 73 20 70 72 | 6f 63 65 64 75 72 65 73 |tives pr|ocedures|
|00000cc0| 2e 20 46 6f 72 20 69 6e | 73 74 61 6e 63 65 2c 20 |. For in|stance, |
|00000cd0| 63 72 65 61 74 69 6e 67 | 20 61 20 6e 65 77 20 62 |creating| a new b|
|00000ce0| 75 74 74 6f 6e 20 63 61 | 6e 20 62 65 20 64 6f 6e |utton ca|n be don|
|00000cf0| 65 20 77 69 74 68 0a 5c | 62 65 67 69 6e 7b 76 65 |e with.\|begin{ve|
|00000d00| 72 62 61 74 69 6d 7d 0a | 20 20 20 20 28 62 75 74 |rbatim}.| (but|
|00000d10| 74 6f 6e 20 22 2e 62 22 | 29 0a 5c 65 6e 64 7b 76 |ton ".b"|).\end{v|
|00000d20| 65 72 62 61 74 69 6d 7d | 0a 4e 6f 74 65 20 74 68 |erbatim}|.Note th|
|00000d30| 61 74 20 74 68 65 20 6e | 61 6d 65 20 6f 66 20 74 |at the n|ame of t|
|00000d40| 68 65 20 77 69 64 67 65 | 74 20 6d 75 73 74 20 62 |he widge|t must b|
|00000d50| 65 20 60 60 73 74 72 69 | 6e 67 69 66 69 65 64 27 |e ``stri|ngified'|
|00000d60| 27 20 64 75 65 20 74 6f | 20 74 68 65 20 53 63 68 |' due to| the Sch|
|00000d70| 65 6d 65 0a 65 76 61 6c | 75 61 74 69 6f 6e 20 6d |eme.eval|uation m|
|00000d80| 65 63 68 61 6e 69 73 6d | 2e 20 54 68 65 20 63 61 |echanism|. The ca|
|00000d90| 6c 6c 20 6f 66 20 61 20 | 77 69 64 67 65 74 20 63 |ll of a |widget c|
|00000da0| 72 65 61 74 69 6f 6e 20 | 70 72 69 6d 69 74 69 76 |reation |primitiv|
|00000db0| 65 20 64 65 66 69 6e 65 | 73 20 61 20 6e 65 77 0a |e define|s a new.|
|00000dc0| 53 63 68 65 6d 65 20 6f | 62 6a 65 63 74 2e 20 54 |Scheme o|bject. T|
|00000dd0| 68 69 73 20 6f 62 6a 65 | 63 74 2c 20 77 68 69 63 |his obje|ct, whic|
|00000de0| 68 20 69 73 20 63 6f 6e | 73 69 64 65 72 65 64 20 |h is con|sidered |
|00000df0| 61 73 20 61 20 6e 65 77 | 20 62 61 73 69 63 20 74 |as a new| basic t|
|00000e00| 79 70 65 20 62 79 20 74 | 68 65 0a 53 63 68 65 6d |ype by t|he.Schem|
|00000e10| 65 20 69 6e 74 65 72 70 | 72 65 74 65 72 2c 20 69 |e interp|reter, i|
|00000e20| 73 20 61 75 74 6f 6d 61 | 74 69 63 61 6c 6c 79 20 |s automa|tically |
|00000e30| 73 74 6f 72 65 64 20 69 | 6e 20 61 20 76 61 72 69 |stored i|n a vari|
|00000e40| 61 62 6c 65 20 77 68 6f | 73 65 20 6e 61 6d 65 20 |able who|se name |
|00000e50| 69 73 20 65 71 75 61 6c | 0a 74 6f 20 74 68 65 20 |is equal|.to the |
|00000e60| 73 74 72 69 6e 67 20 70 | 61 73 73 65 64 20 74 6f |string p|assed to|
|00000e70| 20 74 68 65 20 63 72 65 | 61 74 69 6f 6e 20 66 75 | the cre|ation fu|
|00000e80| 6e 63 74 69 6f 6e 2e 20 | 53 6f 2c 20 74 68 65 20 |nction. |So, the |
|00000e90| 70 72 65 63 65 64 69 6e | 67 20 62 75 74 74 6f 6e |precedin|g button|
|00000ea0| 0a 63 72 65 61 74 69 6f | 6e 20 77 6f 75 6c 64 20 |.creatio|n would |
|00000eb0| 64 65 66 69 6e 65 20 61 | 6e 20 6f 62 6a 65 63 74 |define a|n object|
|00000ec0| 20 73 74 6f 72 65 64 20 | 69 6e 20 74 68 65 7e 7b | stored |in the~{|
|00000ed0| 5c 74 74 20 2e 62 7d 20 | 76 61 72 69 61 62 6c 65 |\tt .b} |variable|
|00000ee0| 2e 20 54 68 69 73 20 6f | 62 6a 65 63 74 0a 69 73 |. This o|bject.is|
|00000ef0| 20 61 20 73 70 65 63 69 | 61 6c 20 6b 69 6e 64 20 | a speci|al kind |
|00000f00| 6f 66 20 70 72 6f 63 65 | 64 75 72 65 20 77 68 69 |of proce|dure whi|
|00000f10| 63 68 20 69 73 20 67 65 | 6e 65 72 61 6c 6c 79 20 |ch is ge|nerally |
|00000f20| 75 73 65 64 2c 20 61 73 | 20 69 6e 20 70 75 72 65 |used, as| in pure|
|00000f30| 20 54 6b 2c 20 74 6f 0a | 63 75 73 74 6f 6d 69 7a | Tk, to.|customiz|
|00000f40| 65 20 69 74 73 20 61 73 | 73 6f 63 69 61 74 65 64 |e its as|sociated|
|00000f50| 20 77 69 64 67 65 74 2e | 20 46 6f 72 20 69 6e 73 | widget.| For ins|
|00000f60| 74 61 6e 63 65 2c 20 74 | 68 65 20 65 78 70 72 65 |tance, t|he expre|
|00000f70| 73 73 69 6f 6e 20 7b 5c | 73 6d 61 6c 6c 0a 5c 62 |ssion {\|small.\b|
|00000f80| 65 67 69 6e 7b 76 65 72 | 62 61 74 69 6d 7d 0a 20 |egin{ver|batim}. |
|00000f90| 20 20 20 28 2e 62 20 27 | 63 6f 6e 66 69 67 75 72 | (.b '|configur|
|00000fa0| 65 20 0a 20 20 20 20 20 | 20 20 20 27 2d 74 65 78 |e . | '-tex|
|00000fb0| 74 20 22 48 65 6c 6c 6f | 2c 20 77 6f 72 6c 64 22 |t "Hello|, world"|
|00000fc0| 20 0a 20 20 20 20 20 20 | 20 20 27 2d 62 6f 72 64 | . | '-bord|
|00000fd0| 65 72 20 33 29 0a 5c 65 | 6e 64 7b 76 65 72 62 61 |er 3).\e|nd{verba|
|00000fe0| 74 69 6d 7d 0a 7d 0a 5c | 6e 6f 69 6e 64 65 6e 74 |tim}.}.\|noindent|
|00000ff0| 0a 70 65 72 6d 69 74 73 | 20 74 6f 20 73 65 74 20 |.permits| to set |
|00001000| 74 68 65 20 74 65 78 74 | 20 61 6e 64 20 62 61 63 |the text| and bac|
|00001010| 6b 67 72 6f 75 6e 64 20 | 6f 70 74 69 6f 6e 73 20 |kground |options |
|00001020| 6f 66 20 74 68 65 7e 7b | 5c 74 74 20 2e 62 7d 20 |of the~{|\tt .b} |
|00001030| 62 75 74 74 6f 6e 2e 20 | 41 73 0a 77 65 20 63 61 |button. |As.we ca|
|00001040| 6e 20 73 65 65 20 6f 6e | 20 74 68 69 73 20 65 78 |n see on| this ex|
|00001050| 61 6d 70 6c 65 2c 20 70 | 61 72 61 6d 65 74 65 72 |ample, p|arameter|
|00001060| 73 20 6d 75 73 74 20 62 | 65 20 77 65 6c 6c 20 71 |s must b|e well q|
|00001070| 75 6f 74 65 64 20 69 6e | 20 72 65 67 61 72 64 20 |uoted in| regard |
|00001080| 6f 66 20 74 68 65 20 0a | 53 63 68 65 6d 65 20 65 |of the .|Scheme e|
|00001090| 76 61 6c 75 61 74 69 6f | 6e 20 72 75 6c 65 73 2e |valuatio|n rules.|
|000010a0| 20 53 69 6e 63 65 20 74 | 68 69 73 20 6e 6f 74 61 | Since t|his nota|
|000010b0| 74 69 6f 6e 20 69 73 20 | 62 61 72 65 6c 79 20 63 |tion is |barely c|
|000010c0| 72 75 64 65 2c 20 74 68 | 65 20 43 6f 6d 6d 6f 6e |rude, th|e Common|
|000010d0| 20 4c 69 73 70 0a 6b 65 | 79 77 6f 72 64 20 6d 65 | Lisp.ke|yword me|
|000010e0| 63 68 61 6e 69 73 6d 20 | 68 61 73 20 62 65 65 6e |chanism |has been|
|000010f0| 20 69 6e 74 72 6f 64 75 | 63 65 64 20 69 6e 20 74 | introdu|ced in t|
|00001100| 68 65 20 53 63 68 65 6d | 65 20 69 6e 74 65 72 70 |he Schem|e interp|
|00001110| 72 65 74 65 72 20 7b 5c | 63 69 74 65 7b 43 4c 74 |reter {\|cite{CLt|
|00001120| 6c 32 7d 7d 0a 7b 5c 66 | 6f 6f 74 6e 6f 74 65 7b |l2}}.{\f|ootnote{|
|00001130| 41 20 6b 65 79 77 6f 72 | 64 20 69 73 20 61 20 73 |A keywor|d is a s|
|00001140| 79 6d 62 6f 6c 20 62 65 | 67 69 6e 6e 69 6e 67 20 |ymbol be|ginning |
|00001150| 77 69 74 68 20 61 20 63 | 6f 6c 6f 6e 2e 20 49 74 |with a c|olon. It|
|00001160| 20 63 61 6e 20 62 65 65 | 6e 20 73 65 65 6e 0a 61 | can bee|n seen.a|
|00001170| 73 20 61 20 73 79 6d 62 | 6f 6c 69 63 20 63 6f 6e |s a symb|olic con|
|00001180| 73 74 61 6e 74 20 28 69 | 2e 65 2e 20 69 74 73 20 |stant (i|.e. its |
|00001190| 76 61 6c 75 65 20 69 73 | 20 69 74 73 65 6c 66 29 |value is| itself)|
|000011a0| 7d 7d 2e 20 43 6f 6e 73 | 65 71 75 65 6e 74 6c 79 |}}. Cons|equently|
|000011b0| 2c 20 74 68 65 20 70 72 | 65 63 65 64 69 6e 67 0a |, the pr|eceding.|
|000011c0| 65 78 70 72 65 73 73 69 | 6f 6e 20 63 6f 75 6c 64 |expressi|on could|
|000011d0| 20 68 61 76 65 20 62 65 | 65 6e 20 77 72 69 74 74 | have be|en writt|
|000011e0| 65 6e 20 61 73 20 20 0a | 5c 6e 6f 69 6e 64 65 6e |en as .|\noinden|
|000011f0| 74 0a 7b 5c 73 6d 61 6c | 6c 0a 5c 62 65 67 69 6e |t.{\smal|l.\begin|
|00001200| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 20 20 20 20 28 |{verbati|m}. (|
|00001210| 2e 62 20 27 63 6f 6e 66 | 69 67 75 72 65 20 0a 20 |.b 'conf|igure . |
|00001220| 20 20 20 20 20 20 20 3a | 74 65 78 74 20 22 48 65 | :|text "He|
|00001230| 6c 6c 6f 2c 20 77 6f 72 | 6c 64 22 20 0a 20 20 20 |llo, wor|ld" . |
|00001240| 20 20 20 20 20 3a 62 6f | 72 64 65 72 20 33 29 0a | :bo|rder 3).|
|00001250| 5c 65 6e 64 7b 76 65 72 | 62 61 74 69 6d 7d 0a 7d |\end{ver|batim}.}|
|00001260| 0a 5c 6e 6f 69 6e 64 65 | 6e 74 0a 77 68 69 63 68 |.\noinde|nt.which|
|00001270| 20 69 6e 20 74 75 72 6e | 20 69 73 20 62 6f 74 68 | in turn| is both|
|00001280| 20 63 6c 6f 73 65 20 66 | 72 6f 6d 20 43 6f 6d 6d | close f|rom Comm|
|00001290| 6f 6e 20 4c 69 73 70 20 | 61 6e 64 20 70 75 72 65 |on Lisp |and pure|
|000012a0| 20 54 6b 2e 20 4f 66 20 | 63 6f 75 72 73 65 2c 20 | Tk. Of |course, |
|000012b0| 61 73 20 69 6e 0a 54 6b | 2c 20 70 61 72 61 6d 65 |as in.Tk|, parame|
|000012c0| 74 65 72 73 20 63 61 6e | 20 62 65 20 70 61 73 73 |ters can| be pass|
|000012d0| 65 64 20 61 74 20 77 69 | 64 67 65 74 20 63 72 65 |ed at wi|dget cre|
|000012e0| 61 74 69 6f 6e 20 74 69 | 6d 65 20 61 6e 64 20 6f |ation ti|me and o|
|000012f0| 75 72 20 62 75 74 74 6f | 6e 20 63 72 65 61 74 69 |ur butto|n creati|
|00001300| 6f 6e 0a 61 6e 64 20 69 | 6e 69 74 69 61 6c 69 7a |on.and i|nitializ|
|00001310| 61 74 69 6f 6e 20 63 6f | 75 6c 64 20 68 61 76 65 |ation co|uld have|
|00001320| 20 62 65 65 6e 20 64 6f | 6e 65 20 69 6e 20 61 20 | been do|ne in a |
|00001330| 73 69 6e 67 6c 65 20 65 | 78 70 72 65 73 73 69 6f |single e|xpressio|
|00001340| 6e 3a 0a 7b 5c 73 6d 61 | 6c 6c 0a 5c 62 65 67 69 |n:.{\sma|ll.\begi|
|00001350| 6e 7b 76 65 72 62 61 74 | 69 6d 7d 0a 20 20 20 20 |n{verbat|im}. |
|00001360| 28 62 75 74 74 6f 6e 20 | 2e 62 20 0a 20 20 20 20 |(button |.b . |
|00001370| 20 20 20 20 20 20 20 20 | 3a 74 65 78 74 20 22 48 | |:text "H|
|00001380| 65 6c 6c 6f 2c 20 77 6f | 72 6c 64 22 20 0a 20 20 |ello, wo|rld" . |
|00001390| 20 20 20 20 20 20 20 20 | 20 20 3a 62 6f 72 64 65 | | :borde|
|000013a0| 72 20 33 29 0a 5c 65 6e | 64 7b 76 65 72 62 61 74 |r 3).\en|d{verbat|
|000013b0| 69 6d 7d 0a 7d 0a 0a 54 | 68 65 20 54 6b 20 62 69 |im}.}..T|he Tk bi|
|000013c0| 6e 64 69 6e 67 20 6d 65 | 63 68 61 6e 69 73 6d 2c |nding me|chanism,|
|000013d0| 20 77 68 69 63 68 20 73 | 65 72 76 65 73 20 74 6f | which s|erves to|
|000013e0| 20 63 72 65 61 74 65 20 | 77 69 64 67 65 74 20 65 | create |widget e|
|000013f0| 76 65 6e 74 20 68 61 6e | 64 6c 65 72 73 20 66 6f |vent han|dlers fo|
|00001400| 6c 6c 6f 77 0a 74 68 65 | 20 73 61 6d 65 20 6b 69 |llow.the| same ki|
|00001410| 6e 64 20 6f 66 20 72 75 | 6c 65 73 2e 20 54 68 65 |nd of ru|les. The|
|00001420| 20 62 6f 64 79 20 6f 66 | 20 61 20 54 6b 20 68 61 | body of| a Tk ha|
|00001430| 6e 64 6c 65 72 20 6d 75 | 73 74 20 62 65 20 77 72 |ndler mu|st be wr|
|00001440| 69 74 74 65 6e 2c 20 6f | 66 0a 63 6f 75 72 73 65 |itten, o|f.course|
|00001450| 2c 20 69 6e 20 53 63 68 | 65 6d 65 2e 20 46 6f 6c |, in Sch|eme. Fol|
|00001460| 6c 6f 77 69 6e 67 20 65 | 78 61 6d 70 6c 65 20 73 |lowing e|xample s|
|00001470| 68 6f 77 73 20 73 75 63 | 68 20 61 20 73 63 72 69 |hows suc|h a scri|
|00001480| 70 74 3b 20 69 6e 20 74 | 68 69 73 20 65 78 61 6d |pt; in t|his exam|
|00001490| 70 6c 65 2c 20 74 68 65 | 0a 6c 61 62 65 6c 20 69 |ple, the|.label i|
|000014a0| 6e 64 69 63 61 74 65 73 | 20 68 6f 77 20 6d 61 6e |ndicates| how man|
|000014b0| 79 20 74 69 6d 65 73 20 | 6d 6f 75 73 65 20 62 75 |y times |mouse bu|
|000014c0| 74 74 6f 6e 20 33 20 68 | 61 73 20 62 65 65 6e 20 |tton 3 h|as been |
|000014d0| 64 65 70 72 65 73 73 65 | 64 2e 0a 42 75 74 74 6f |depresse|d..Butto|
|000014e0| 6e 20 70 72 65 73 73 20 | 63 6f 75 6e 74 65 72 20 |n press |counter |
|000014f0| 69 6e 63 72 65 6d 65 6e | 74 20 69 73 20 61 63 68 |incremen|t is ach|
|00001500| 69 65 76 65 64 20 77 69 | 74 68 20 74 68 65 20 73 |ieved wi|th the s|
|00001510| 69 6d 70 6c 65 20 73 63 | 72 69 70 74 0a 67 69 76 |imple sc|ript.giv|
|00001520| 65 6e 20 69 6e 20 74 68 | 65 20 7b 5c 74 74 20 62 |en in th|e {\tt b|
|00001530| 69 6e 64 7d 20 63 61 6c | 6c 2e 0a 7b 5c 73 6d 61 |ind} cal|l..{\sma|
|00001540| 6c 6c 0a 5c 62 65 67 69 | 6e 7b 76 65 72 62 61 74 |ll.\begi|n{verbat|
|00001550| 69 6d 7d 0a 20 20 20 20 | 28 64 65 66 69 6e 65 20 |im}. |(define |
|00001560| 63 6f 75 6e 74 20 30 29 | 0a 20 20 20 20 28 70 61 |count 0)|. (pa|
|00001570| 63 6b 20 27 61 70 70 65 | 6e 64 20 22 2e 22 20 0a |ck 'appe|nd "." .|
|00001580| 20 20 20 20 20 20 20 20 | 20 20 28 6c 61 62 65 6c | | (label|
|00001590| 20 22 2e 6c 22 20 0a 20 | 20 20 20 20 20 20 20 20 | ".l" . | |
|000015a0| 20 20 20 20 20 20 20 20 | 20 3a 74 65 78 74 76 61 | | :textva|
|000015b0| 72 69 61 62 6c 65 20 27 | 63 6f 75 6e 74 29 20 0a |riable '|count) .|
|000015c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000015d0| 20 20 22 66 69 6c 6c 22 | 29 0a 20 20 20 20 28 62 | "fill"|). (b|
|000015e0| 69 6e 64 20 2e 6c 20 22 | 3c 33 3e 22 20 0a 20 20 |ind .l "|<3>" . |
|000015f0| 20 20 20 20 20 20 20 20 | 20 20 20 27 28 73 65 74 | | '(set|
|00001600| 21 20 63 6f 75 6e 74 20 | 28 2b 20 63 6f 75 6e 74 |! count |(+ count|
|00001610| 20 31 29 29 29 0a 5c 65 | 6e 64 7b 76 65 72 62 61 | 1))).\e|nd{verba|
|00001620| 74 69 6d 7d 0a 7d 0a 0a | 54 6f 20 69 6c 6c 75 73 |tim}.}..|To illus|
|00001630| 74 72 61 74 65 20 7b 5c | 73 74 6b 7d 20 66 69 72 |trate {\|stk} fir|
|00001640| 73 74 20 6c 65 76 65 6c | 20 6f 66 20 70 72 6f 67 |st level| of prog|
|00001650| 72 61 6d 6d 69 6e 67 2c | 20 46 69 67 75 72 65 7e |ramming,| Figure~|
|00001660| 31 20 73 68 6f 77 73 20 | 74 68 65 20 73 69 6d 70 |1 shows |the simp|
|00001670| 6c 65 0a 66 69 6c 65 20 | 62 72 6f 77 73 65 72 20 |le.file |browser |
|00001680| 64 65 73 63 72 69 62 65 | 64 20 69 6e 20 7b 5c 63 |describe|d in {\c|
|00001690| 69 74 65 7b 4f 75 73 74 | 65 72 2d 54 63 6c 7d 7d |ite{Oust|er-Tcl}}|
|000016a0| 20 77 72 69 74 74 65 6e | 20 69 6e 20 7b 5c 73 74 | written| in {\st|
|000016b0| 6b 7d 2e 0a 0a 5c 62 65 | 67 69 6e 7b 66 69 67 75 |k}...\be|gin{figu|
|000016c0| 72 65 2a 7d 5b 74 5d 0a | 7b 5c 73 6d 61 6c 6c 0a |re*}[t].|{\small.|
|000016d0| 5c 76 73 6b 69 70 32 6d | 6d 0a 5c 62 65 67 69 6e |\vskip2m|m.\begin|
|000016e0| 7b 71 75 6f 74 65 7d 0a | 5c 62 65 67 69 6e 7b 76 |{quote}.|\begin{v|
|000016f0| 65 72 62 61 74 69 6d 7d | 0a 23 21 2f 75 73 72 2f |erbatim}|.#!/usr/|
|00001700| 6c 6f 63 61 6c 2f 62 69 | 6e 2f 73 74 6b 20 2d 66 |local/bi|n/stk -f|
|00001710| 0a 0a 28 73 63 72 6f 6c | 6c 62 61 72 20 22 2e 73 |..(scrol|lbar ".s|
|00001720| 63 72 6f 6c 6c 22 20 3a | 63 6f 6d 6d 61 6e 64 20 |croll" :|command |
|00001730| 22 2e 6c 69 73 74 20 27 | 79 76 69 65 77 22 29 0a |".list '|yview").|
|00001740| 28 6c 69 73 74 62 6f 78 | 20 22 2e 6c 69 73 74 22 |(listbox| ".list"|
|00001750| 20 3a 79 73 63 72 6f 6c | 6c 20 22 2e 73 63 72 6f | :yscrol|l ".scro|
|00001760| 6c 6c 20 27 73 65 74 22 | 20 3a 72 65 6c 69 65 66 |ll 'set"| :relief|
|00001770| 20 27 72 61 69 73 65 64 | 20 3a 67 65 6f 6d 65 74 | 'raised| :geomet|
|00001780| 72 79 20 22 32 30 78 32 | 30 22 29 0a 28 70 61 63 |ry "20x2|0").(pac|
|00001790| 6b 20 27 61 70 70 65 6e | 64 20 22 2e 22 20 2e 73 |k 'appen|d "." .s|
|000017a0| 63 72 6f 6c 6c 20 22 72 | 69 67 68 74 20 66 69 6c |croll "r|ight fil|
|000017b0| 6c 79 22 20 2e 6c 69 73 | 74 20 22 6c 65 66 74 20 |ly" .lis|t "left |
|000017c0| 65 78 70 61 6e 64 20 66 | 69 6c 6c 22 29 0a 0a 28 |expand f|ill")..(|
|000017d0| 64 65 66 69 6e 65 20 28 | 62 72 6f 77 73 65 20 64 |define (|browse d|
|000017e0| 69 72 20 66 69 6c 65 29 | 0a 20 20 28 69 66 20 28 |ir file)|. (if (|
|000017f0| 6e 6f 74 20 28 73 74 72 | 69 6e 67 3d 3f 20 64 69 |not (str|ing=? di|
|00001800| 72 20 22 2e 22 29 29 20 | 28 73 65 74 21 20 66 69 |r ".")) |(set! fi|
|00001810| 6c 65 20 28 73 74 72 69 | 6e 67 2d 61 70 70 65 6e |le (stri|ng-appen|
|00001820| 64 20 64 69 72 20 22 2f | 22 20 66 69 6c 65 29 29 |d dir "/|" file))|
|00001830| 29 0a 20 20 28 69 66 20 | 28 64 69 72 65 63 74 6f |). (if |(directo|
|00001840| 72 79 3f 20 66 69 6c 65 | 29 0a 20 20 20 20 20 20 |ry? file|). |
|00001850| 28 73 79 73 74 65 6d 20 | 28 66 6f 72 6d 61 74 20 |(system |(format |
|00001860| 23 66 20 22 62 72 6f 77 | 73 65 2e 73 74 6b 20 7e |#f "brow|se.stk ~|
|00001870| 41 20 26 22 20 66 69 6c | 65 29 29 0a 20 20 20 20 |A &" fil|e)). |
|00001880| 20 20 28 69 66 20 28 66 | 69 6c 65 3f 20 66 69 6c | (if (f|ile? fil|
|00001890| 65 29 0a 20 20 20 20 20 | 20 20 20 20 20 28 6c 65 |e). | (le|
|000018a0| 74 20 28 28 65 64 20 28 | 67 65 74 65 6e 76 20 22 |t ((ed (|getenv "|
|000018b0| 45 44 49 54 4f 52 22 29 | 29 29 0a 20 20 20 20 20 |EDITOR")|)). |
|000018c0| 20 20 20 20 20 20 20 28 | 69 66 20 65 64 0a 20 20 | (|if ed. |
|000018d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 28 73 | | (s|
|000018e0| 79 73 74 65 6d 20 28 73 | 74 72 69 6e 67 2d 61 70 |ystem (s|tring-ap|
|000018f0| 70 65 6e 64 20 65 64 20 | 22 20 22 20 66 69 6c 65 |pend ed |" " file|
|00001900| 20 22 26 22 29 29 0a 20 | 20 20 20 20 20 20 20 20 | "&")). | |
|00001910| 20 20 20 20 20 20 20 28 | 73 79 73 74 65 6d 20 28 | (|system (|
|00001920| 73 74 72 69 6e 67 2d 61 | 70 70 65 6e 64 20 22 78 |string-a|ppend "x|
|00001930| 65 64 69 74 20 22 20 66 | 69 6c 65 20 22 26 22 29 |edit " f|ile "&")|
|00001940| 29 29 29 0a 20 20 20 20 | 20 20 20 20 20 20 28 65 |))). | (e|
|00001950| 72 72 6f 72 20 22 42 61 | 64 20 64 69 72 65 63 74 |rror "Ba|d direct|
|00001960| 6f 72 79 20 6f 72 20 66 | 69 6c 65 22 20 66 69 6c |ory or f|ile" fil|
|00001970| 65 29 29 29 29 0a 0a 28 | 64 65 66 69 6e 65 20 64 |e))))..(|define d|
|00001980| 69 72 20 28 69 66 20 28 | 3e 20 61 72 67 63 20 30 |ir (if (|> argc 0|
|00001990| 29 20 28 63 61 72 20 61 | 72 67 76 29 20 22 2e 22 |) (car a|rgv) "."|
|000019a0| 29 29 0a 0a 28 73 79 73 | 74 65 6d 20 28 66 6f 72 |))..(sys|tem (for|
|000019b0| 6d 61 74 20 23 66 20 22 | 6c 73 20 2d 61 20 7e 41 |mat #f "|ls -a ~A|
|000019c0| 20 3e 20 2f 74 6d 70 2f | 62 72 6f 77 73 65 22 20 | > /tmp/|browse" |
|000019d0| 64 69 72 29 29 0a 0a 28 | 77 69 74 68 2d 69 6e 70 |dir))..(|with-inp|
|000019e0| 75 74 2d 66 72 6f 6d 2d | 66 69 6c 65 20 22 2f 74 |ut-from-|file "/t|
|000019f0| 6d 70 2f 62 72 6f 77 73 | 65 22 20 28 6c 61 6d 62 |mp/brows|e" (lamb|
|00001a00| 64 61 28 29 0a 20 20 28 | 64 6f 20 28 28 66 20 28 |da(). (|do ((f (|
|00001a10| 72 65 61 64 2d 6c 69 6e | 65 29 20 28 72 65 61 64 |read-lin|e) (read|
|00001a20| 2d 6c 69 6e 65 29 29 29 | 0a 20 20 20 20 20 20 28 |-line)))|. (|
|00001a30| 28 65 6f 66 2d 6f 62 6a | 65 63 74 3f 20 66 29 29 |(eof-obj|ect? f))|
|00001a40| 0a 20 20 20 20 28 2e 6c | 69 73 74 20 27 69 6e 73 |. (.l|ist 'ins|
|00001a50| 65 72 74 20 27 65 6e 64 | 20 66 29 29 29 29 0a 0a |ert 'end| f))))..|
|00001a60| 28 62 69 6e 64 20 2e 6c | 69 73 74 20 22 3c 43 6f |(bind .l|ist "<Co|
|00001a70| 6e 74 72 6f 6c 2d 63 3e | 22 20 27 28 64 65 73 74 |ntrol-c>|" '(dest|
|00001a80| 72 6f 79 20 22 2e 22 29 | 29 0a 28 62 69 6e 64 20 |roy ".")|).(bind |
|00001a90| 2e 6c 69 73 74 20 22 3c | 44 6f 75 62 6c 65 2d 42 |.list "<|Double-B|
|00001aa0| 75 74 74 6f 6e 2d 31 3e | 22 20 27 28 62 72 6f 77 |utton-1>|" '(brow|
|00001ab0| 73 65 20 64 69 72 20 28 | 73 65 6c 65 63 74 69 6f |se dir (|selectio|
|00001ac0| 6e 20 27 67 65 74 29 29 | 29 0a 5c 65 6e 64 7b 76 |n 'get))|).\end{v|
|00001ad0| 65 72 62 61 74 69 6d 7d | 0a 5c 65 6e 64 7b 71 75 |erbatim}|.\end{qu|
|00001ae0| 6f 74 65 7d 0a 7d 0a 5c | 63 61 70 74 69 6f 6e 7b |ote}.}.\|caption{|
|00001af0| 5c 65 6d 20 41 20 73 69 | 6d 70 6c 65 20 66 69 6c |\em A si|mple fil|
|00001b00| 65 20 62 72 6f 77 73 65 | 72 7d 0a 5c 76 73 6b 69 |e browse|r}.\vski|
|00001b10| 70 32 6d 6d 0a 5c 68 72 | 75 6c 65 0a 5c 65 6e 64 |p2mm.\hr|ule.\end|
|00001b20| 7b 66 69 67 75 72 65 2a | 7d 0a 0a 5c 73 65 63 74 |{figure*|}..\sect|
|00001b30| 69 6f 6e 7b 5c 73 74 6b | 3a 20 53 65 63 6f 6e 64 |ion{\stk|: Second|
|00001b40| 20 6c 65 76 65 6c 7d 0a | 0a 50 72 6f 67 72 61 6d | level}.|.Program|
|00001b50| 6d 69 6e 67 20 77 69 74 | 68 20 6d 61 74 65 72 69 |ming wit|h materi|
|00001b60| 61 6c 20 73 68 6f 77 6e | 20 62 65 66 6f 72 65 20 |al shown| before |
|00001b70| 69 73 20 61 20 6c 69 74 | 74 6c 65 20 62 69 74 20 |is a lit|tle bit |
|00001b80| 74 65 64 69 6f 75 73 20 | 61 6e 64 20 6d 6f 72 65 |tedious |and more|
|00001b90| 0a 63 6f 6d 70 6c 69 63 | 61 74 65 64 20 74 68 61 |.complic|ated tha|
|00001ba0| 6e 20 63 6f 64 69 6e 67 | 20 77 69 74 68 20 54 63 |n coding| with Tc|
|00001bb0| 6c 20 73 69 6e 63 65 20 | 6f 6e 65 20 68 61 76 65 |l since |one have|
|00001bc0| 20 74 6f 20 61 64 64 20 | 70 61 72 65 6e 74 68 65 | to add |parenthe|
|00001bd0| 73 69 73 20 70 61 69 72 | 73 20 61 6e 64 20 0a 71 |sis pair|s and .q|
|00001be0| 75 6f 74 65 20 6f 70 74 | 69 6f 6e 73 20 76 61 6c |uote opt|ions val|
|00001bf0| 75 65 73 2e 20 49 74 73 | 20 6f 6e 6c 79 20 69 6e |ues. Its| only in|
|00001c00| 74 65 72 65 73 74 20 69 | 73 20 74 6f 20 62 72 69 |terest i|s to bri|
|00001c10| 6e 67 20 74 68 65 20 70 | 6f 77 65 72 20 61 6e 64 |ng the p|ower and|
|00001c20| 20 66 6c 65 78 69 62 69 | 6c 69 74 79 20 6f 66 0a | flexibi|lity of.|
|00001c30| 54 6b 20 74 6f 20 74 68 | 65 20 53 63 68 65 6d 65 |Tk to th|e Scheme|
|00001c40| 20 77 6f 72 6c 64 2e 20 | 0a 0a 54 68 65 20 73 65 | world. |..The se|
|00001c50| 63 6f 6e 64 20 6c 65 76 | 65 6c 20 6f 66 20 5c 73 |cond lev|el of \s|
|00001c60| 74 6b 20 69 73 20 66 61 | 72 20 6d 6f 72 65 20 69 |tk is fa|r more i|
|00001c70| 6e 74 65 72 65 73 74 69 | 6e 67 20 73 69 6e 63 65 |nteresti|ng since|
|00001c80| 20 69 74 20 75 73 65 73 | 20 61 20 66 75 6c 6c 20 | it uses| a full |
|00001c90| 6f 62 6a 65 63 74 0a 6f | 72 69 65 6e 74 65 64 20 |object.o|riented |
|00001ca0| 65 78 74 65 6e 73 69 6f | 6e 20 6f 66 20 74 68 65 |extensio|n of the|
|00001cb0| 20 53 63 68 65 6d 65 20 | 6c 61 6e 67 75 61 67 65 | Scheme |language|
|00001cc0| 2e 20 44 65 66 69 6e 69 | 6e 67 20 61 6e 20 6f 62 |. Defini|ng an ob|
|00001cd0| 6a 65 63 74 20 6f 72 69 | 65 6e 74 65 64 20 6c 61 |ject ori|ented la|
|00001ce0| 79 65 72 0a 6f 6e 20 53 | 63 68 65 6d 65 20 69 73 |yer.on S|cheme is|
|00001cf0| 20 61 20 63 75 72 72 65 | 6e 74 20 61 63 74 69 76 | a curre|nt activ|
|00001d00| 69 74 79 20 69 6e 20 74 | 68 65 20 53 63 68 65 6d |ity in t|he Schem|
|00001d10| 65 20 63 6f 6d 6d 75 6e | 69 74 79 20 61 6e 64 20 |e commun|ity and |
|00001d20| 73 65 76 65 72 61 6c 20 | 70 61 63 6b 61 67 65 73 |several |packages|
|00001d30| 0a 61 72 65 20 61 76 61 | 69 6c 61 62 6c 65 2e 20 |.are ava|ilable. |
|00001d40| 54 68 65 20 6f 62 6a 65 | 63 74 20 6c 61 79 65 72 |The obje|ct layer|
|00001d50| 20 6f 66 20 5c 73 74 6b | 20 69 73 20 64 65 72 69 | of \stk| is deri|
|00001d60| 76 65 64 20 66 72 6f 6d | 20 61 20 70 61 63 6b 61 |ved from| a packa|
|00001d70| 67 65 20 63 61 6c 6c 65 | 64 20 7b 5c 65 6d 0a 54 |ge calle|d {\em.T|
|00001d80| 69 6e 79 20 43 6c 6f 73 | 7d 7e 7b 5c 63 69 74 65 |iny Clos|}~{\cite|
|00001d90| 7b 54 69 6e 79 2d 43 6c | 6f 73 7d 7d 2e 20 54 68 |{Tiny-Cl|os}}. Th|
|00001da0| 69 73 20 65 78 74 65 6e | 73 69 6f 6e 20 70 72 6f |is exten|sion pro|
|00001db0| 76 69 64 65 73 20 6f 62 | 6a 65 63 74 73 20 7b 5c |vides ob|jects {\|
|00001dc0| 65 6d 20 5c 60 61 20 6c | 61 7d 0a 43 4c 4f 53 20 |em \`a l|a}.CLOS |
|00001dd0| 28 43 6f 6d 6d 6f 6e 20 | 4c 69 73 70 20 4f 62 6a |(Common |Lisp Obj|
|00001de0| 65 63 74 20 53 79 73 74 | 65 6d 29 2e 20 49 6e 20 |ect Syst|em). In |
|00001df0| 66 61 63 74 2c 20 74 68 | 65 20 70 72 6f 70 6f 73 |fact, th|e propos|
|00001e00| 65 64 20 65 78 74 65 6e | 73 69 6f 6e 20 69 73 20 |ed exten|sion is |
|00001e10| 6d 75 63 68 0a 63 6c 6f | 73 65 72 20 66 72 6f 6d |much.clo|ser from|
|00001e20| 20 74 68 65 20 6f 62 6a | 65 63 74 73 20 6f 6e 65 | the obj|ects one|
|00001e30| 20 63 61 6e 20 66 69 6e | 64 20 69 6e 20 44 79 6c | can fin|d in Dyl|
|00001e40| 61 6e 2c 20 73 69 6e 63 | 65 20 74 68 69 73 20 6c |an, sinc|e this l|
|00001e50| 61 6e 67 75 61 67 65 20 | 69 73 20 61 6c 72 65 61 |anguage |is alrea|
|00001e60| 64 79 0a 61 20 74 65 6e | 74 61 74 69 76 65 20 74 |dy.a ten|tative t|
|00001e70| 6f 20 6d 65 72 67 65 20 | 43 4c 4f 53 20 6e 6f 74 |o merge |CLOS not|
|00001e80| 69 6f 6e 73 20 69 6e 20 | 61 20 53 63 68 65 6d 65 |ions in |a Scheme|
|00001e90| 20 6c 69 6b 65 20 6c 61 | 6e 67 75 61 67 65 20 7b | like la|nguage {|
|00001ea0| 5c 63 69 74 65 7b 44 79 | 6c 61 6e 7d 7d 2e 0a 0a |\cite{Dy|lan}}...|
|00001eb0| 5c 73 74 6b 20 6f 62 6a | 65 63 74 20 65 78 74 65 |\stk obj|ect exte|
|00001ec0| 6e 73 69 6f 6e 20 67 69 | 76 65 73 20 74 6f 20 74 |nsion gi|ves to t|
|00001ed0| 68 65 20 75 73 65 72 20 | 61 20 66 75 6c 6c 20 6f |he user |a full o|
|00001ee0| 62 6a 65 63 74 20 6f 72 | 69 65 6e 74 65 64 20 0a |bject or|iented .|
|00001ef0| 73 79 73 74 65 6d 20 77 | 69 74 68 20 6d 75 6c 74 |system w|ith mult|
|00001f00| 69 2d 69 6e 68 65 72 69 | 74 61 6e 63 65 20 61 6e |i-inheri|tance an|
|00001f10| 64 20 67 65 6e 65 72 69 | 63 20 66 75 6e 63 74 69 |d generi|c functi|
|00001f20| 6f 6e 73 2e 20 46 75 72 | 74 68 65 72 6d 6f 72 65 |ons. Fur|thermore|
|00001f30| 2c 20 61 6c 6c 20 74 68 | 65 0a 69 6d 70 6c 65 6d |, all th|e.implem|
|00001f40| 65 6e 74 61 74 69 6f 6e | 20 72 65 6c 79 20 6f 6e |entation| rely on|
|00001f50| 20 61 20 74 72 75 65 20 | 6d 65 74 61 20 6f 62 6a | a true |meta obj|
|00001f60| 65 63 74 20 70 72 6f 74 | 6f 63 6f 6c 2c 20 69 6e |ect prot|ocol, in|
|00001f70| 20 74 68 65 20 73 70 69 | 72 69 74 20 6f 66 0a 7b | the spi|rit of.{|
|00001f80| 5c 63 69 74 65 7b 41 4d | 4f 50 7d 7d 2e 20 54 68 |\cite{AM|OP}}. Th|
|00001f90| 69 73 20 6d 6f 64 65 6c | 20 68 61 73 20 62 65 65 |is model| has bee|
|00001fa0| 6e 20 75 73 65 64 20 74 | 6f 20 65 6d 62 6f 64 79 |n used t|o embody|
|00001fb0| 20 61 6c 6c 20 74 68 65 | 20 70 72 65 64 65 66 69 | all the| predefi|
|00001fc0| 6e 65 64 20 54 6b 0a 77 | 69 64 67 65 74 73 20 69 |ned Tk.w|idgets i|
|00001fd0| 6e 20 61 20 68 69 65 72 | 61 72 63 68 79 20 6f 66 |n a hier|archy of|
|00001fe0| 20 53 74 6b 20 63 6c 61 | 73 73 65 73 2e 0a 0a 5c | Stk cla|sses...\|
|00001ff0| 73 75 62 73 65 63 74 69 | 6f 6e 7b 43 6c 61 73 73 |subsecti|on{Class|
|00002000| 20 68 69 65 72 61 72 63 | 68 79 7d 0a 0a 57 69 74 | hierarc|hy}..Wit|
|00002010| 68 20 74 68 65 20 5c 73 | 74 6b 20 6f 62 6a 65 63 |h the \s|tk objec|
|00002020| 74 20 73 79 73 74 65 6d | 2c 20 65 76 65 72 79 20 |t system|, every |
|00002030| 54 6b 20 67 72 61 70 68 | 69 63 61 6c 20 6f 62 6a |Tk graph|ical obj|
|00002040| 65 63 74 20 75 73 65 64 | 20 69 6e 20 61 20 70 72 |ect used| in a pr|
|00002050| 6f 67 72 61 6d 20 73 75 | 63 68 0a 61 73 20 61 20 |ogram su|ch.as a |
|00002060| 6d 65 6e 75 2c 20 61 20 | 6c 61 62 65 6c 20 6f 72 |menu, a |label or|
|00002070| 20 61 20 62 75 74 74 6f | 6e 20 69 73 20 72 65 70 | a butto|n is rep|
|00002080| 72 65 73 65 6e 74 65 64 | 20 61 73 20 61 6e 20 6f |resented| as an o|
|00002090| 62 6a 65 63 74 20 69 6e | 20 74 68 65 20 53 63 68 |bject in| the Sch|
|000020a0| 65 6d 65 20 63 6f 72 65 | 2e 0a 41 6c 6c 20 74 68 |eme core|..All th|
|000020b0| 65 20 64 65 66 69 6e 65 | 64 20 7b 5c 73 74 6b 7d |e define|d {\stk}|
|000020c0| 20 63 6c 61 73 73 65 73 | 20 62 75 69 6c 64 20 61 | classes| build a|
|000020d0| 20 68 69 65 72 61 72 63 | 68 79 20 77 68 69 63 68 | hierarc|hy which|
|000020e0| 20 69 73 20 62 72 69 65 | 66 6c 79 20 64 65 73 63 | is brie|fly desc|
|000020f0| 72 69 62 65 64 0a 68 65 | 72 65 2e 20 46 69 72 73 |ribed.he|re. Firs|
|00002100| 74 6c 79 2c 20 61 6c 6c | 20 74 68 65 20 63 6c 61 |tly, all| the cla|
|00002110| 73 73 65 73 20 73 68 61 | 72 65 64 20 61 20 75 6e |sses sha|red a un|
|00002120| 69 71 75 65 20 61 6e 63 | 65 73 74 6f 72 3a 20 74 |ique anc|estor: t|
|00002130| 68 65 20 7b 5c 65 6d 0a | 24 3c 24 54 6b 2d 6f 62 |he {\em.|$<$Tk-ob|
|00002140| 6a 65 63 74 24 3e 24 7d | 20 63 6c 61 73 73 2e 20 |ject$>$}| class. |
|00002150| 49 6e 73 74 61 6e 63 65 | 73 20 6f 66 20 74 68 69 |Instance|s of thi|
|00002160| 73 20 63 6c 61 73 73 20 | 63 6f 6e 74 61 69 6e 20 |s class |contain |
|00002170| 69 6e 66 6f 72 6d 61 74 | 69 6f 6e 73 20 77 68 69 |informat|ions whi|
|00002180| 63 68 20 61 72 65 0a 6e | 65 63 65 73 73 61 72 79 |ch are.n|ecessary|
|00002190| 20 74 6f 20 65 73 74 61 | 62 6c 69 73 68 20 61 20 | to esta|blish a |
|000021a0| 63 6f 6d 6d 75 6e 69 63 | 61 74 69 6f 6e 20 62 65 |communic|ation be|
|000021b0| 74 77 65 65 6e 20 74 68 | 65 20 53 63 68 65 6d 65 |tween th|e Scheme|
|000021c0| 20 61 6e 64 20 54 6b 20 | 77 6f 72 6c 64 73 2e 0a | and Tk |worlds..|
|000021d0| 4f 62 6a 65 63 74 73 20 | 6f 66 20 74 68 69 73 20 |Objects |of this |
|000021e0| 63 6c 61 73 73 20 68 61 | 76 65 20 74 77 6f 20 6d |class ha|ve two m|
|000021f0| 61 69 6e 20 73 6c 6f 74 | 73 20 6e 61 6d 65 64 20 |ain slot|s named |
|00002200| 7b 5c 74 74 20 49 64 5c | 69 6e 64 65 78 7b 49 64 |{\tt Id\|index{Id|
|00002210| 20 73 6c 6f 74 7d 7d 20 | 61 6e 64 20 7b 5c 74 74 | slot}} |and {\tt|
|00002220| 0a 70 61 72 65 6e 74 5c | 69 6e 64 65 78 7b 70 61 |.parent\|index{pa|
|00002230| 72 65 6e 74 20 73 6c 6f | 74 7d 7d 2e 20 54 68 65 |rent slo|t}}. The|
|00002240| 20 7b 5c 74 74 20 49 64 | 7d 20 73 6c 6f 74 20 63 | {\tt Id|} slot c|
|00002250| 6f 6e 74 61 69 6e 73 20 | 61 20 73 74 72 69 6e 67 |ontains |a string|
|00002260| 2c 20 6e 6f 72 6d 61 6c | 6c 79 0a 67 65 6e 65 72 |, normal|ly.gener|
|00002270| 61 74 65 64 20 62 79 20 | 74 68 65 20 73 79 73 74 |ated by |the syst|
|00002280| 65 6d 2c 20 77 68 69 63 | 68 20 63 6f 72 72 65 73 |em, whic|h corres|
|00002290| 70 6f 6e 64 20 74 6f 20 | 61 20 28 75 6e 69 71 75 |pond to |a (uniqu|
|000022a0| 65 29 20 76 61 72 69 61 | 62 6c 65 20 6e 61 6d 65 |e) varia|ble name|
|000022b0| 20 69 6e 20 74 68 65 0a | 54 6b 20 77 6f 72 6c 64 | in the.|Tk world|
|000022c0| 2e 20 54 68 65 20 7b 5c | 74 74 20 70 61 72 65 6e |. The {\|tt paren|
|000022d0| 74 7d 20 73 6c 6f 74 20 | 63 6f 6e 74 61 69 6e 73 |t} slot |contains|
|000022e0| 20 61 20 72 65 66 65 72 | 65 6e 63 65 20 74 6f 20 | a refer|ence to |
|000022f0| 74 68 65 20 6f 62 6a 65 | 63 74 20 77 68 69 63 68 |the obje|ct which|
|00002300| 0a 28 67 72 61 70 68 69 | 63 61 6c 6c 79 29 20 69 |.(graphi|cally) i|
|00002310| 6e 63 6c 75 64 65 73 20 | 74 68 65 20 63 75 72 72 |ncludes |the curr|
|00002320| 65 6e 74 20 6f 62 6a 65 | 63 74 2e 20 4e 6f 72 6d |ent obje|ct. Norm|
|00002330| 61 6c 6c 79 2c 20 65 6e | 64 20 75 73 65 72 73 20 |ally, en|d users |
|00002340| 77 69 6c 6c 20 6e 6f 74 | 20 68 61 76 65 20 74 6f |will not| have to|
|00002350| 0a 75 73 65 20 64 69 72 | 65 63 74 20 69 6e 73 74 |.use dir|ect inst|
|00002360| 61 6e 63 65 73 20 6f 66 | 20 74 68 65 20 7b 5c 65 |ances of| the {\e|
|00002370| 6d 20 24 3c 24 54 6b 2d | 6f 62 6a 65 63 74 24 3e |m $<$Tk-|object$>|
|00002380| 24 7d 20 63 6c 61 73 73 | 5c 66 6f 6f 74 6e 6f 74 |$} class|\footnot|
|00002390| 65 7b 20 41 6c 6c 20 63 | 6c 61 73 73 65 73 0a 77 |e{ All c|lasses.w|
|000023a0| 68 6f 73 65 20 6e 61 6d | 65 20 62 65 67 69 6e 73 |hose nam|e begins|
|000023b0| 20 77 69 74 68 20 74 68 | 65 20 60 60 54 6b 2d 27 | with th|e ``Tk-'|
|000023c0| 27 20 70 72 65 66 69 78 | 20 61 72 65 20 6e 6f 74 |' prefix| are not|
|000023d0| 20 69 6e 74 65 6e 64 65 | 64 20 66 6f 72 20 74 68 | intende|d for th|
|000023e0| 65 20 66 69 6e 61 6c 20 | 75 73 65 72 2e 7d 2e 0a |e final |user.}..|
|000023f0| 0a 0a 54 68 65 20 6e 65 | 78 74 20 6c 65 76 65 6c |..The ne|xt level|
|00002400| 20 69 6e 20 6f 75 72 20 | 63 6c 61 73 73 20 68 69 | in our |class hi|
|00002410| 65 72 61 72 63 68 79 20 | 64 65 66 69 6e 65 73 20 |erarchy |defines |
|00002420| 61 20 66 6f 72 6b 20 77 | 69 74 68 20 74 77 6f 20 |a fork w|ith two |
|00002430| 62 72 61 6e 63 68 65 73 | 3a 20 74 68 65 0a 7b 5c |branches|: the.{\|
|00002440| 65 6d 20 24 3c 24 54 6b | 2d 77 69 64 67 65 74 24 |em $<$Tk|-widget$|
|00002450| 3e 24 5c 69 6e 64 65 78 | 7b 54 6b 2d 77 69 64 67 |>$\index|{Tk-widg|
|00002460| 65 74 20 63 6c 61 73 73 | 7d 7d 20 63 6c 61 73 73 |et class|}} class|
|00002470| 20 61 6e 64 20 7b 5c 65 | 6d 0a 24 3c 24 54 6b 2d | and {\e|m.$<$Tk-|
|00002480| 63 61 6e 76 61 73 2d 69 | 74 65 6d 24 3e 24 5c 69 |canvas-i|tem$>$\i|
|00002490| 6e 64 65 78 7b 54 6b 2d | 63 61 6e 76 61 73 2d 69 |ndex{Tk-|canvas-i|
|000024a0| 74 65 6d 20 63 6c 61 73 | 73 7d 7d 20 63 6c 61 73 |tem clas|s}} clas|
|000024b0| 73 2e 20 49 6e 73 74 61 | 6e 63 65 73 20 6f 66 20 |s. Insta|nces of |
|000024c0| 74 68 65 0a 66 6f 72 6d | 65 72 20 63 6c 61 73 73 |the.form|er class|
|000024d0| 20 61 72 65 20 63 6c 61 | 73 73 69 63 61 6c 20 77 | are cla|ssical w|
|000024e0| 69 64 67 65 74 73 20 73 | 75 63 68 20 61 73 20 62 |idgets s|uch as b|
|000024f0| 75 74 74 6f 6e 73 20 6f | 72 20 6d 65 6e 75 73 20 |uttons o|r menus |
|00002500| 73 69 6e 63 65 20 69 6e | 73 74 61 6e 63 65 73 20 |since in|stances |
|00002510| 6f 66 0a 74 68 65 20 6c | 61 74 65 72 20 61 72 65 |of.the l|ater are|
|00002520| 20 6f 62 6a 65 63 74 73 | 20 63 6f 6e 74 61 69 6e | objects| contain|
|00002530| 65 64 20 69 6e 20 61 20 | 63 61 6e 76 61 73 20 73 |ed in a |canvas s|
|00002540| 75 63 68 20 61 73 20 6c | 69 6e 65 73 20 6f 72 20 |uch as l|ines or |
|00002550| 72 65 63 74 61 6e 67 6c | 65 73 2e 20 54 6b 0a 77 |rectangl|es. Tk.w|
|00002560| 69 64 67 65 74 73 20 61 | 72 65 20 61 6c 73 6f 20 |idgets a|re also |
|00002570| 64 69 76 69 64 65 64 20 | 69 6e 20 74 77 6f 20 63 |divided |in two c|
|00002580| 61 74 65 67 6f 72 69 65 | 73 3a 20 7b 5c 65 6d 20 |ategorie|s: {\em |
|00002590| 24 3c 24 54 6b 2d 73 69 | 6d 70 6c 65 2d 77 69 64 |$<$Tk-si|mple-wid|
|000025a0| 67 65 74 73 24 3e 24 7d | 20 61 6e 64 0a 7b 5c 65 |gets$>$}| and.{\e|
|000025b0| 6d 20 24 3c 24 54 6b 2d | 63 6f 6d 70 6f 73 69 74 |m $<$Tk-|composit|
|000025c0| 65 2d 77 69 64 67 65 74 | 73 24 3e 24 7d 2e 20 53 |e-widget|s$>$}. S|
|000025d0| 69 6d 70 6c 65 20 77 69 | 64 67 65 74 73 20 61 72 |imple wi|dgets ar|
|000025e0| 65 20 64 69 72 65 63 74 | 6c 79 20 69 6d 70 6c 65 |e direct|ly imple|
|000025f0| 6d 65 6e 74 65 64 20 61 | 73 0a 54 6b 20 6f 62 6a |mented a|s.Tk obj|
|00002600| 65 63 74 73 20 61 6e 64 | 20 63 6f 6d 70 6f 73 69 |ects and| composi|
|00002610| 74 65 20 6f 6e 65 73 20 | 61 72 65 20 62 75 69 6c |te ones |are buil|
|00002620| 74 20 75 70 6f 6e 20 73 | 69 6d 70 6c 65 20 77 69 |t upon s|imple wi|
|00002630| 64 67 65 74 73 20 28 65 | 2e 67 2e 20 66 69 6c 65 |dgets (e|.g. file|
|00002640| 0a 62 72 6f 77 73 65 72 | 2c 20 61 6c 65 72 74 20 |.browser|, alert |
|00002650| 6d 65 73 73 61 67 65 73 | 20 61 6e 64 20 73 6f 20 |messages| and so |
|00002660| 6f 6e 29 2e 20 20 41 20 | 70 61 72 74 69 61 6c 20 |on). A |partial |
|00002670| 76 69 65 77 20 6f 66 20 | 74 68 65 0a 5c 73 74 6b |view of |the.\stk|
|00002680| 20 68 69 65 72 61 72 63 | 68 79 20 69 73 20 73 68 | hierarc|hy is sh|
|00002690| 6f 77 6e 20 69 6e 20 46 | 69 67 75 72 65 7e 32 2e |own in F|igure~2.|
|000026a0| 0a 5c 62 65 67 69 6e 7b | 66 69 67 75 72 65 2a 7d |.\begin{|figure*}|
|000026b0| 0a 25 5c 63 65 6e 74 65 | 72 6c 69 6e 65 7b 5c 70 |.%\cente|rline{\p|
|000026c0| 73 66 69 67 7b 66 69 67 | 75 72 65 3d 7b 46 69 67 |sfig{fig|ure={Fig|
|000026d0| 31 2d 31 2e 69 64 72 61 | 77 7d 2c 68 65 69 67 68 |1-1.idra|w},heigh|
|000026e0| 74 3d 7b 32 2e 30 30 69 | 6e 7d 2c 77 69 64 74 68 |t={2.00i|n},width|
|000026f0| 3d 7b 32 2e 30 30 69 6e | 7d 7d 7d 0a 5c 63 65 6e |={2.00in|}}}.\cen|
|00002700| 74 65 72 6c 69 6e 65 7b | 5c 70 73 66 69 67 7b 66 |terline{|\psfig{f|
|00002710| 69 67 75 72 65 3d 7b 68 | 69 65 72 61 72 63 68 79 |igure={h|ierarchy|
|00002720| 2e 65 70 73 7d 2c 77 69 | 64 74 68 3d 7b 35 2e 30 |.eps},wi|dth={5.0|
|00002730| 30 69 6e 7d 2c 77 69 64 | 74 68 3d 7b 35 2e 30 30 |0in},wid|th={5.00|
|00002740| 69 6e 7d 7d 7d 0a 5c 63 | 61 70 74 69 6f 6e 7b 5c |in}}}.\c|aption{\|
|00002750| 65 6d 20 41 20 70 61 72 | 74 69 61 6c 20 76 69 65 |em A par|tial vie|
|00002760| 77 20 6f 66 20 5c 73 74 | 6b 20 68 69 65 72 61 72 |w of \st|k hierar|
|00002770| 63 68 79 7d 0a 5c 76 73 | 6b 69 70 32 6d 6d 0a 5c |chy}.\vs|kip2mm.\|
|00002780| 68 72 75 6c 65 0a 5c 65 | 6e 64 7b 66 69 67 75 72 |hrule.\e|nd{figur|
|00002790| 65 2a 7d 0a 0a 5c 73 75 | 62 73 65 63 74 69 6f 6e |e*}..\su|bsection|
|000027a0| 7b 42 61 73 69 63 20 6e | 6f 74 69 6f 6e 73 7d 0a |{Basic n|otions}.|
|000027b0| 0a 54 68 69 73 20 73 65 | 63 74 69 6f 6e 20 64 65 |.This se|ction de|
|000027c0| 73 63 72 69 62 65 73 20 | 62 61 73 69 63 20 63 6f |scribes |basic co|
|000027d0| 6e 63 65 70 74 73 20 6f | 66 20 6f 75 72 20 6f 62 |ncepts o|f our ob|
|000027e0| 6a 65 63 74 20 65 78 74 | 65 6e 73 69 6f 6e 20 6f |ject ext|ension o|
|000027f0| 6e 20 61 20 73 6d 61 6c | 6c 20 0a 65 78 61 6d 70 |n a smal|l .examp|
|00002800| 6c 65 2e 20 44 65 66 69 | 6e 69 74 69 6f 6e 20 6f |le. Defi|nition o|
|00002810| 66 20 61 20 6e 65 77 20 | 6f 62 6a 65 63 74 20 63 |f a new |object c|
|00002820| 6c 61 73 73 20 69 73 20 | 64 6f 6e 65 20 77 69 74 |lass is |done wit|
|00002830| 68 20 74 68 65 20 7b 5c | 65 6d 20 64 65 66 63 6c |h the {\|em defcl|
|00002840| 61 73 73 7d 20 66 6f 72 | 6d 2e 20 0a 46 6f 72 20 |ass} for|m. .For |
|00002850| 69 6e 73 74 61 6e 63 65 | 2c 0a 7b 5c 73 6d 61 6c |instance|,.{\smal|
|00002860| 6c 0a 5c 62 65 67 69 6e | 7b 76 65 72 62 61 74 69 |l.\begin|{verbati|
|00002870| 6d 7d 0a 20 20 20 20 28 | 64 65 66 63 6c 61 73 73 |m}. (|defclass|
|00002880| 20 70 65 72 73 6f 6e 20 | 28 29 0a 20 20 20 20 20 | person |(). |
|00002890| 20 20 28 28 6e 61 6d 65 | 20 3a 69 6e 69 74 61 72 | ((name| :initar|
|000028a0| 67 20 3a 6e 61 6d 65 0a | 20 20 20 20 20 20 20 20 |g :name.| |
|000028b0| 20 20 20 20 20 20 3a 61 | 63 63 65 73 73 6f 72 20 | :a|ccessor |
|000028c0| 6e 61 6d 65 20 0a 20 20 | 20 20 20 20 20 20 28 61 |name . | (a|
|000028d0| 67 65 20 20 3a 69 6e 69 | 74 61 72 67 20 3a 61 67 |ge :ini|targ :ag|
|000028e0| 65 29 29 29 29 0a 5c 65 | 6e 64 7b 76 65 72 62 61 |e)))).\e|nd{verba|
|000028f0| 74 69 6d 7d 0a 7d 0a 5c | 6e 6f 69 6e 64 65 6e 74 |tim}.}.\|noindent|
|00002900| 0a 64 65 66 69 6e 65 73 | 20 61 20 70 65 72 73 6f |.defines| a perso|
|00002910| 6e 20 63 68 61 72 61 63 | 74 65 72 69 73 74 69 63 |n charac|teristic|
|00002920| 73 2e 20 54 77 6f 20 73 | 6c 6f 74 73 20 61 72 65 |s. Two s|lots are|
|00002930| 20 64 65 63 6c 61 72 65 | 64 3a 20 7b 5c 74 74 20 | declare|d: {\tt |
|00002940| 6e 61 6d 65 7d 20 61 6e | 64 20 0a 7b 5c 74 74 20 |name} an|d .{\tt |
|00002950| 61 67 65 7d 2e 20 43 68 | 61 72 61 63 74 65 72 69 |age}. Ch|aracteri|
|00002960| 73 74 69 63 73 20 6f 66 | 20 61 20 73 6c 6f 74 20 |stics of| a slot |
|00002970| 61 72 65 20 65 78 70 72 | 65 73 73 65 64 20 77 69 |are expr|essed wi|
|00002980| 74 68 20 69 74 73 20 64 | 65 66 69 6e 69 74 69 6f |th its d|efinitio|
|00002990| 6e 2e 20 0a 48 65 72 65 | 2c 20 66 6f 72 20 69 6e |n. .Here|, for in|
|000029a0| 73 74 61 6e 63 65 2c 20 | 69 74 20 69 73 20 73 61 |stance, |it is sa|
|000029b0| 69 64 20 74 68 61 74 20 | 74 68 65 20 73 6c 6f 74 |id that |the slot|
|000029c0| 20 7b 5c 74 74 20 6e 61 | 6d 65 7d 20 63 61 6e 20 | {\tt na|me} can |
|000029d0| 62 65 20 69 6e 69 74 65 | 64 20 77 69 74 68 20 0a |be inite|d with .|
|000029e0| 74 68 65 20 6b 65 79 77 | 6f 72 64 20 7b 5c 74 74 |the keyw|ord {\tt|
|000029f0| 20 3a 6e 61 6d 65 7d 20 | 75 70 6f 6e 20 69 6e 73 | :name} |upon ins|
|00002a00| 74 61 6e 63 65 20 63 72 | 65 61 74 69 6f 6e 20 61 |tance cr|eation a|
|00002a10| 6e 64 20 74 68 61 74 20 | 61 6e 20 61 63 63 65 73 |nd that |an acces|
|00002a20| 73 6f 72 20 66 75 6e 63 | 74 69 6f 6e 20 0a 73 68 |sor func|tion .sh|
|00002a30| 6f 75 6c 64 20 62 65 20 | 67 65 6e 65 72 61 74 65 |ould be |generate|
|00002a40| 64 20 66 6f 72 20 69 74 | 2e 20 43 72 65 61 74 69 |d for it|. Creati|
|00002a50| 6f 6e 20 6f 66 20 61 20 | 6e 65 77 20 69 6e 73 74 |on of a |new inst|
|00002a60| 61 6e 63 65 20 69 73 20 | 64 6f 6e 65 20 77 69 74 |ance is |done wit|
|00002a70| 68 20 74 68 65 20 0a 7b | 5c 74 74 20 6d 61 6b 65 |h the .{|\tt make|
|00002a80| 7d 20 63 6f 6e 73 74 72 | 75 63 74 6f 72 3a 0a 7b |} constr|uctor:.{|
|00002a90| 5c 73 6d 61 6c 6c 0a 5c | 62 65 67 69 6e 7b 76 65 |\small.\|begin{ve|
|00002aa0| 72 62 61 74 69 6d 7d 0a | 20 20 20 20 28 64 65 66 |rbatim}.| (def|
|00002ab0| 69 6e 65 20 70 20 28 6d | 61 6b 65 20 70 65 72 73 |ine p (m|ake pers|
|00002ac0| 6f 6e 20 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |on . | |
|00002ad0| 20 20 20 20 20 20 20 3a | 6e 61 6d 65 20 22 53 6d | :|name "Sm|
|00002ae0| 69 74 68 22 0a 20 20 20 | 20 20 20 20 20 20 20 20 |ith". | |
|00002af0| 20 20 20 20 20 20 20 20 | 3a 61 67 65 20 34 32 29 | |:age 42)|
|00002b00| 29 0a 5c 65 6e 64 7b 76 | 65 72 62 61 74 69 6d 7d |).\end{v|erbatim}|
|00002b10| 0a 7d 0a 5c 6e 6f 69 6e | 64 65 6e 74 0a 54 68 69 |.}.\noin|dent.Thi|
|00002b20| 73 20 63 61 6c 6c 20 70 | 65 72 6d 69 74 73 20 74 |s call p|ermits t|
|00002b30| 6f 20 62 75 69 6c 64 20 | 61 20 6e 65 77 20 70 65 |o build |a new pe|
|00002b40| 72 73 6f 6e 20 61 6e 64 | 20 74 6f 20 69 6e 69 74 |rson and| to init|
|00002b50| 69 61 6c 69 7a 65 20 74 | 68 65 20 73 6c 6f 74 73 |ialize t|he slots|
|00002b60| 20 77 68 69 63 68 0a 63 | 6f 6d 70 6f 73 65 20 68 | which.c|ompose h|
|00002b70| 69 6d 2f 68 65 72 2e 0a | 0a 52 65 61 64 69 6e 67 |im/her..|.Reading|
|00002b80| 20 74 68 65 20 76 61 6c | 75 65 20 6f 66 20 61 20 | the val|ue of a |
|00002b90| 73 6c 6f 74 20 63 61 6e | 20 62 65 20 64 6f 6e 65 |slot can| be done|
|00002ba0| 20 77 69 74 68 20 74 68 | 65 20 66 75 6e 63 74 69 | with th|e functi|
|00002bb0| 6f 6e 20 7b 5c 74 74 20 | 73 6c 6f 74 2d 76 61 6c |on {\tt |slot-val|
|00002bc0| 75 65 7d 2e 0a 46 6f 72 | 20 69 6e 73 74 61 6e 63 |ue}..For| instanc|
|00002bd0| 65 2c 0a 7b 5c 73 6d 61 | 6c 6c 0a 5c 62 65 67 69 |e,.{\sma|ll.\begi|
|00002be0| 6e 7b 76 65 72 62 61 74 | 69 6d 7d 0a 20 20 20 20 |n{verbat|im}. |
|00002bf0| 28 73 6c 6f 74 2d 76 61 | 6c 75 65 20 70 20 27 61 |(slot-va|lue p 'a|
|00002c00| 67 65 29 0a 5c 65 6e 64 | 7b 76 65 72 62 61 74 69 |ge).\end|{verbati|
|00002c10| 6d 7d 0a 7d 0a 5c 6e 6f | 69 6e 64 65 6e 74 0a 70 |m}.}.\no|indent.p|
|00002c20| 65 72 6d 69 74 73 20 74 | 6f 20 67 65 74 20 74 68 |ermits t|o get th|
|00002c30| 65 20 76 61 6c 75 65 20 | 6f 66 20 73 6c 6f 74 20 |e value |of slot |
|00002c40| 7b 5c 74 74 20 61 67 65 | 7d 20 6f 66 20 74 68 65 |{\tt age|} of the|
|00002c50| 20 7b 5c 74 74 20 70 7d | 20 6f 62 6a 65 63 74 2e | {\tt p}| object.|
|00002c60| 0a 53 65 74 74 69 6e 67 | 20 74 68 69 73 20 73 6c |.Setting| this sl|
|00002c70| 6f 74 20 63 61 6e 20 62 | 65 20 64 6f 6e 65 20 62 |ot can b|e done b|
|00002c80| 79 20 75 73 69 6e 67 20 | 74 68 65 20 67 65 6e 65 |y using |the gene|
|00002c90| 72 61 6c 69 7a 65 64 20 | 7b 5c 74 74 20 73 65 74 |ralized |{\tt set|
|00002ca0| 21 7d 20 64 65 66 69 6e | 65 64 20 69 6e 20 5c 73 |!} defin|ed in \s|
|00002cb0| 74 6b 3a 0a 7b 5c 73 6d | 61 6c 6c 0a 5c 62 65 67 |tk:.{\sm|all.\beg|
|00002cc0| 69 6e 7b 76 65 72 62 61 | 74 69 6d 7d 0a 20 20 20 |in{verba|tim}. |
|00002cd0| 20 28 73 65 74 21 20 28 | 73 6c 6f 74 2d 76 61 6c | (set! (|slot-val|
|00002ce0| 75 65 20 70 20 27 61 67 | 65 29 20 34 33 29 0a 5c |ue p 'ag|e) 43).\|
|00002cf0| 65 6e 64 7b 76 65 72 62 | 61 74 69 6d 7d 0a 7d 0a |end{verb|atim}.}.|
|00002d00| 5c 6e 6f 69 6e 64 65 6e | 74 0a 53 69 6e 63 65 20 |\noinden|t.Since |
|00002d10| 61 6e 20 61 63 63 65 73 | 73 6f 72 20 61 73 20 61 |an acces|sor as a|
|00002d20| 6c 73 6f 20 62 65 65 6e | 20 64 65 66 69 6e 65 64 |lso been| defined|
|00002d30| 20 6f 6e 20 74 68 65 20 | 7b 5c 74 74 20 6e 61 6d | on the |{\tt nam|
|00002d40| 65 7d 20 73 6c 6f 74 2c | 20 69 74 20 63 61 6e 20 |e} slot,| it can |
|00002d50| 62 65 20 72 65 61 64 0a | 77 69 74 68 20 74 68 65 |be read.|with the|
|00002d60| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 65 78 70 72 65 | followi|ng expre|
|00002d70| 73 73 69 6f 6e 3a 0a 7b | 5c 73 6d 61 6c 6c 0a 5c |ssion:.{|\small.\|
|00002d80| 62 65 67 69 6e 7b 76 65 | 72 62 61 74 69 6d 7d 0a |begin{ve|rbatim}.|
|00002d90| 20 20 20 20 28 6e 61 6d | 65 20 70 29 0a 5c 65 6e | (nam|e p).\en|
|00002da0| 64 7b 76 65 72 62 61 74 | 69 6d 7d 0a 7d 0a 41 73 |d{verbat|im}.}.As|
|00002db0| 20 62 65 66 6f 72 65 2c | 20 73 6c 6f 74 20 73 65 | before,| slot se|
|00002dc0| 74 74 69 6e 67 20 63 61 | 6e 20 62 65 20 64 6f 6e |tting ca|n be don|
|00002dd0| 65 20 77 69 74 68 20 74 | 68 65 20 67 65 6e 65 72 |e with t|he gener|
|00002de0| 61 6c 69 7a 65 64 20 7b | 5c 74 74 20 73 65 74 21 |alized {|\tt set!|
|00002df0| 7d 20 61 73 20 69 6e 0a | 7b 5c 73 6d 61 6c 6c 0a |} as in.|{\small.|
|00002e00| 5c 62 65 67 69 6e 7b 76 | 65 72 62 61 74 69 6d 7d |\begin{v|erbatim}|
|00002e10| 0a 20 20 20 20 28 73 65 | 74 21 20 28 6e 61 6d 65 |. (se|t! (name|
|00002e20| 20 70 29 20 34 33 29 0a | 5c 65 6e 64 7b 76 65 72 | p) 43).|\end{ver|
|00002e30| 62 61 74 69 6d 7d 0a 7d | 0a 0a 5c 73 75 62 73 65 |batim}.}|..\subse|
|00002e40| 63 74 69 6f 6e 7b 54 6b | 20 63 6c 61 73 73 65 73 |ction{Tk| classes|
|00002e50| 7d 0a 4e 6f 77 20 74 68 | 61 74 20 62 61 73 69 63 |}.Now th|at basic|
|00002e60| 20 63 6f 6e 63 65 70 74 | 73 20 68 61 76 65 20 62 | concept|s have b|
|00002e70| 65 65 6e 20 65 78 70 6f | 73 65 64 2c 20 6c 65 74 |een expo|sed, let|
|00002e80| 20 63 6f 6d 65 20 62 61 | 63 6b 20 74 6f 20 68 6f | come ba|ck to ho|
|00002e90| 77 20 75 73 69 6e 67 20 | 54 6b 20 77 69 74 68 0a |w using |Tk with.|
|00002ea0| 74 68 65 20 6f 62 6a 65 | 63 74 20 6c 61 79 65 72 |the obje|ct layer|
|00002eb0| 2e 20 49 6e 20 6f 75 72 | 20 6d 6f 64 65 6c 2c 20 |. In our| model, |
|00002ec0| 65 61 63 68 20 54 6b 20 | 6f 70 74 69 6f 6e 20 69 |each Tk |option i|
|00002ed0| 73 20 64 65 66 69 6e 65 | 64 20 61 73 20 61 20 73 |s define|d as a s|
|00002ee0| 6c 6f 74 2e 20 46 6f 72 | 0a 69 6e 73 74 61 6e 63 |lot. For|.instanc|
|00002ef0| 65 2c 20 61 20 73 69 6d | 70 6c 69 66 69 65 64 20 |e, a sim|plified |
|00002f00| 64 65 66 69 6e 69 74 69 | 6f 6e 20 6f 66 20 61 20 |definiti|on of a |
|00002f10| 54 6b 20 62 75 74 74 6f | 6e 20 63 6f 75 6c 64 20 |Tk butto|n could |
|00002f20| 62 65 3a 0a 7b 5c 73 6d | 61 6c 6c 0a 5c 62 65 67 |be:.{\sm|all.\beg|
|00002f30| 69 6e 7b 76 65 72 62 61 | 74 69 6d 7d 0a 20 20 20 |in{verba|tim}. |
|00002f40| 20 28 64 65 66 63 6c 61 | 73 73 20 3c 42 75 74 74 | (defcla|ss <Butt|
|00002f50| 6f 6e 3e 20 28 3c 4c 61 | 62 65 6c 3e 29 0a 20 20 |on> (<La|bel>). |
|00002f60| 20 20 20 20 20 28 28 63 | 6f 6d 6d 61 6e 64 20 3a | ((c|ommand :|
|00002f70| 61 63 63 65 73 73 6f 72 | 20 63 6f 6d 6d 61 6e 64 |accessor| command|
|00002f80| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |. | |
|00002f90| 20 20 3a 69 6e 69 74 61 | 72 67 20 3a 63 6f 6d 6d | :inita|rg :comm|
|00002fa0| 61 6e 64 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |and. | |
|00002fb0| 20 20 20 20 20 3a 61 6c | 6c 6f 63 61 74 69 6f 6e | :al|location|
|00002fc0| 20 3a 70 73 65 75 64 6f | 0a 20 20 20 20 20 20 20 | :pseudo|. |
|00002fd0| 20 20 20 20 20 20 20 20 | 20 20 3a 74 79 70 65 20 | | :type |
|00002fe0| 27 61 6e 79 29 29 0a 20 | 20 20 20 20 20 20 3a 6d |'any)). | :m|
|00002ff0| 65 74 61 63 6c 61 73 73 | 20 3c 54 6b 3e 29 0a 5c |etaclass| <Tk>).\|
|00003000| 65 6e 64 7b 76 65 72 62 | 61 74 69 6d 7d 0a 7d 0a |end{verb|atim}.}.|
|00003010| 0a 54 68 69 73 20 64 65 | 66 69 6e 69 74 69 6f 6e |.This de|finition|
|00003020| 20 73 61 79 73 20 74 68 | 61 74 20 61 20 7b 5c 74 | says th|at a {\t|
|00003030| 74 20 24 3c 24 42 75 74 | 74 6f 6e 24 3e 24 7d 20 |t $<$But|ton$>$} |
|00003040| 69 73 20 61 20 28 7b 5c | 65 6d 20 69 6e 68 65 72 |is a ({\|em inher|
|00003050| 69 74 73 7d 20 66 72 6f | 6d 29 20 7b 5c 74 74 0a |its} fro|m) {\tt.|
|00003060| 24 3c 24 4c 61 62 65 6c | 24 3e 24 7d 20 77 69 74 |$<$Label|$>$} wit|
|00003070| 68 20 61 6e 20 65 78 74 | 72 61 20 73 6c 6f 74 20 |h an ext|ra slot |
|00003080| 63 61 6c 6c 65 64 20 7b | 5c 74 74 20 63 6f 6d 6d |called {|\tt comm|
|00003090| 61 6e 64 7d 2e 20 54 68 | 69 73 20 73 6c 6f 74 27 |and}. Th|is slot'|
|000030a0| 73 20 61 6c 6c 6f 63 61 | 74 69 6f 6e 0a 73 63 68 |s alloca|tion.sch|
|000030b0| 65 6d 65 20 69 73 20 73 | 61 69 64 20 74 6f 20 62 |eme is s|aid to b|
|000030c0| 65 20 7b 5c 74 74 20 3a | 70 73 65 75 64 6f 7d 5c |e {\tt :|pseudo}\|
|000030d0| 66 6f 6f 74 6e 6f 74 65 | 7b 20 50 73 65 75 64 6f |footnote|{ Pseudo|
|000030e0| 2d 73 6c 6f 74 73 20 61 | 72 65 20 64 65 66 69 6e |-slots a|re defin|
|000030f0| 65 64 20 69 6e 20 74 68 | 65 0a 6d 65 74 61 63 6c |ed in th|e.metacl|
|00003100| 61 73 73 20 24 3c 24 54 | 6b 24 3e 24 2c 20 68 65 |ass $<$T|k$>$, he|
|00003110| 6e 63 65 20 74 68 65 20 | 7b 5c 74 74 20 3a 6d 65 |nce the |{\tt :me|
|00003120| 74 61 63 6c 61 73 73 7d | 20 6f 70 74 69 6f 6e 20 |taclass}| option |
|00003130| 69 6e 20 64 65 66 69 6e | 69 74 69 6f 6e 2e 7d 2e |in defin|ition.}.|
|00003140| 0a 50 73 65 75 64 6f 2d | 73 6c 6f 74 73 20 61 72 |.Pseudo-|slots ar|
|00003150| 65 20 73 70 65 63 69 61 | 6c 20 70 75 72 70 6f 73 |e specia|l purpos|
|00003160| 65 20 73 6c 6f 74 73 3a | 20 74 68 65 79 20 63 61 |e slots:| they ca|
|00003170| 6e 20 62 65 20 75 73 65 | 64 20 61 73 20 6e 6f 72 |n be use|d as nor|
|00003180| 6d 61 6c 20 73 6c 6f 74 | 73 20 62 75 74 0a 74 68 |mal slot|s but.th|
|00003190| 65 79 20 61 72 65 20 6e | 6f 74 20 61 6c 6c 6f 63 |ey are n|ot alloc|
|000031a0| 61 74 65 64 20 69 6e 20 | 74 68 65 20 53 63 68 65 |ated in |the Sche|
|000031b0| 6d 65 20 77 6f 72 6c 64 | 20 28 69 2e 65 2e 20 74 |me world| (i.e. t|
|000031c0| 68 65 69 72 20 76 61 6c | 75 65 20 69 73 20 73 74 |heir val|ue is st|
|000031d0| 6f 72 65 64 20 69 6e 0a | 6f 6e 65 20 6f 66 20 74 |ored in.|one of t|
|000031e0| 68 65 20 73 74 72 75 63 | 74 75 72 65 73 20 6d 61 |he struc|tures ma|
|000031f0| 6e 69 70 75 6c 61 74 65 | 64 20 62 79 20 74 68 65 |nipulate|d by the|
|00003200| 20 54 6b 20 6c 69 62 72 | 61 72 79 20 69 6e 73 74 | Tk libr|ary inst|
|00003210| 65 61 64 20 6f 66 20 69 | 6e 20 61 20 53 63 68 65 |ead of i|n a Sche|
|00003220| 6d 65 0a 6f 62 6a 65 63 | 74 29 2e 20 4f 66 20 63 |me.objec|t). Of c|
|00003230| 6f 75 72 73 65 2c 20 61 | 63 63 65 73 73 6f 72 73 |ourse, a|ccessors|
|00003240| 20 77 69 6c 6c 20 74 61 | 6b 65 20 69 6e 74 6f 20 | will ta|ke into |
|00003250| 61 63 63 6f 75 6e 74 20 | 74 68 69 73 20 66 61 63 |account |this fac|
|00003260| 74 20 61 6e 64 20 66 75 | 6e 63 74 69 6f 6e 73 0a |t and fu|nctions.|
|00003270| 66 6f 72 20 72 65 61 64 | 69 6e 67 20 6f 72 20 77 |for read|ing or w|
|00003280| 72 69 74 69 6e 67 20 73 | 75 63 68 20 73 6c 6f 74 |riting s|uch slot|
|00003290| 73 20 61 72 65 20 75 6e | 63 68 61 6e 67 65 64 2e |s are un|changed.|
|000032a0| 20 46 6f 72 20 65 78 61 | 6d 70 6c 65 2c 20 0a 7b | For exa|mple, .{|
|000032b0| 5c 73 6d 61 6c 6c 0a 5c | 62 65 67 69 6e 7b 76 65 |\small.\|begin{ve|
|000032c0| 72 62 61 74 69 6d 7d 0a | 20 20 20 20 28 73 65 74 |rbatim}.| (set|
|000032d0| 21 20 28 63 6f 6d 6d 61 | 6e 64 20 62 29 20 27 28 |! (comma|nd b) '(|
|000032e0| 64 69 73 70 6c 61 79 20 | 22 4f 4b 22 29 29 0a 5c |display |"OK")).\|
|000032f0| 65 6e 64 7b 76 65 72 62 | 61 74 69 6d 7d 0a 7d 0a |end{verb|atim}.}.|
|00003300| 5c 6e 6f 69 6e 64 65 6e | 74 0a 70 65 72 6d 69 74 |\noinden|t.permit|
|00003310| 73 20 74 6f 20 73 65 74 | 20 74 68 65 20 73 63 72 |s to set| the scr|
|00003320| 69 70 74 20 61 73 73 6f | 63 69 61 74 65 64 20 74 |ipt asso|ciated t|
|00003330| 6f 20 74 68 65 20 7b 5c | 74 74 20 62 7d 20 62 75 |o the {\|tt b} bu|
|00003340| 74 74 6f 6e 2e 0a 0a 50 | 72 65 63 65 64 69 6e 67 |tton...P|receding|
|00003350| 20 7b 5c 74 74 20 64 65 | 66 63 6c 61 73 73 7d 20 | {\tt de|fclass} |
|00003360| 73 74 61 74 65 73 20 74 | 68 61 74 20 74 68 65 20 |states t|hat the |
|00003370| 7b 5c 74 74 20 63 6f 6d | 6d 61 6e 64 7d 20 73 6c |{\tt com|mand} sl|
|00003380| 6f 74 20 63 61 6e 20 63 | 6f 6e 74 61 69 6e 20 61 |ot can c|ontain a|
|00003390| 0a 76 61 6c 75 65 20 6f | 66 20 61 6e 79 20 74 79 |.value o|f any ty|
|000033a0| 70 65 2e 20 54 79 70 65 | 20 6f 66 20 61 20 73 6c |pe. Type| of a sl|
|000033b0| 6f 74 20 70 65 72 6d 69 | 74 73 20 74 6f 20 74 68 |ot permi|ts to th|
|000033c0| 65 20 73 79 73 74 65 6d | 20 74 6f 20 61 70 70 6c |e system| to appl|
|000033d0| 79 20 74 68 65 20 61 64 | 65 71 75 61 74 65 0a 63 |y the ad|equate.c|
|000033e0| 6f 65 72 63 69 6f 6e 20 | 66 75 6e 63 74 69 6f 6e |oercion |function|
|000033f0| 20 77 68 65 6e 20 61 20 | 73 6c 6f 74 20 69 73 20 | when a |slot is |
|00003400| 72 65 61 64 2e 20 53 69 | 6e 63 65 20 54 6b 20 61 |read. Si|nce Tk a|
|00003410| 6c 77 61 79 73 20 63 6f | 6d 70 75 74 65 73 20 72 |lways co|mputes r|
|00003420| 65 73 75 6c 74 73 20 61 | 73 0a 73 74 72 69 6e 67 |esults a|s.string|
|00003430| 73 2c 20 74 68 69 73 20 | 63 6f 6e 76 65 72 73 69 |s, this |conversi|
|00003440| 6f 6e 20 63 61 6e 20 62 | 65 20 64 6f 6e 65 20 61 |on can b|e done a|
|00003450| 75 74 6f 6d 61 74 69 63 | 61 6c 6c 79 20 77 68 65 |utomatic|ally whe|
|00003460| 6e 20 77 65 20 6b 6e 6f | 77 20 74 68 65 20 74 79 |n we kno|w the ty|
|00003470| 70 65 20 6f 66 0a 74 68 | 65 20 73 6c 6f 74 20 28 |pe of.th|e slot (|
|00003480| 65 2e 67 2e 20 61 20 62 | 6f 72 64 65 72 20 77 69 |e.g. a b|order wi|
|00003490| 64 74 68 20 69 73 20 61 | 6c 77 61 79 73 20 73 74 |dth is a|lways st|
|000034a0| 6f 72 65 64 20 61 73 20 | 61 6e 20 69 6e 74 65 67 |ored as |an integ|
|000034b0| 65 72 20 69 6e 20 54 6b | 0a 73 74 72 75 63 74 75 |er in Tk|.structu|
|000034c0| 72 65 73 29 2e 20 4e 6f | 20 63 6f 6e 76 65 72 73 |res). No| convers|
|000034d0| 69 6f 6e 20 69 73 20 64 | 6f 6e 65 20 77 68 65 6e |ion is d|one when|
|000034e0| 20 61 20 73 6c 6f 74 20 | 69 73 20 77 72 69 74 74 | a slot |is writt|
|000034f0| 65 6e 3b 20 74 68 69 73 | 20 77 6f 72 6b 20 69 73 |en; this| work is|
|00003500| 20 64 6f 6e 65 0a 62 79 | 20 54 6b 20 73 69 6e 63 | done.by| Tk sinc|
|00003510| 65 20 69 74 20 77 69 6c | 6c 20 72 65 6a 65 63 74 |e it wil|l reject|
|00003520| 20 62 61 64 20 76 61 6c | 75 65 73 2e 0a 0a 4e 6f | bad val|ues...No|
|00003530| 74 65 20 74 68 61 74 20 | 75 73 69 6e 67 20 74 68 |te that |using th|
|00003540| 65 20 6f 62 6a 65 63 74 | 20 65 78 74 65 6e 73 69 |e object| extensi|
|00003550| 6f 6e 20 6f 66 20 5c 73 | 74 6b 20 70 65 72 6d 69 |on of \s|tk permi|
|00003560| 74 73 20 74 68 65 20 75 | 73 65 72 20 74 6f 20 66 |ts the u|ser to f|
|00003570| 6f 72 67 65 74 20 73 6f | 6d 65 20 54 6b 0a 69 64 |orget so|me Tk.id|
|00003580| 69 6f 73 79 6e 63 72 61 | 73 69 65 73 2e 20 49 6e |iosyncra|sies. In|
|00003590| 20 70 61 72 74 69 63 75 | 6c 61 72 2c 20 69 74 20 | particu|lar, it |
|000035a0| 70 65 72 6d 69 74 73 20 | 74 6f 20 61 76 6f 69 64 |permits |to avoid|
|000035b0| 20 74 68 65 20 6b 6e 6f | 77 6c 65 64 67 65 20 6f | the kno|wledge o|
|000035c0| 66 20 70 75 72 65 20 54 | 6b 0a 6e 61 6d 69 6e 67 |f pure T|k.naming|
|000035d0| 20 63 6f 6e 76 65 6e 74 | 69 6f 6e 73 2e 20 54 68 | convent|ions. Th|
|000035e0| 65 20 6f 6e 6c 79 20 74 | 68 69 6e 67 20 74 68 65 |e only t|hing the|
|000035f0| 20 75 73 65 72 20 68 61 | 73 20 74 6f 20 6b 6e 6f | user ha|s to kno|
|00003600| 77 20 77 68 65 6e 20 63 | 72 65 61 74 69 6e 67 20 |w when c|reating |
|00003610| 61 20 6e 65 77 0a 6f 62 | 6a 65 63 74 20 69 73 20 |a new.ob|ject is |
|00003620| 69 74 27 73 20 70 61 72 | 65 6e 74 2e 20 41 6e 20 |it's par|ent. An |
|00003630| 65 78 61 6d 70 6c 65 20 | 6f 66 20 77 69 64 67 65 |example |of widge|
|00003640| 74 73 20 63 72 65 61 74 | 69 6f 6e 20 69 73 20 73 |ts creat|ion is s|
|00003650| 68 6f 77 6e 20 62 65 6c | 6f 77 3a 0a 7b 5c 73 6d |hown bel|ow:.{\sm|
|00003660| 61 6c 6c 20 0a 5c 62 65 | 67 69 6e 7b 76 65 72 62 |all .\be|gin{verb|
|00003670| 61 74 69 6d 7d 0a 20 20 | 20 20 28 64 65 66 69 6e |atim}. | (defin|
|00003680| 65 20 66 20 28 6d 61 6b | 65 20 3c 46 72 61 6d 65 |e f (mak|e <Frame|
|00003690| 3e 29 29 0a 20 20 20 20 | 28 64 65 66 69 6e 65 20 |>)). |(define |
|000036a0| 62 31 20 28 6d 61 6b 65 | 20 3c 42 75 74 74 6f 6e |b1 (make| <Button|
|000036b0| 3e 20 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |> . | |
|000036c0| 20 20 20 20 20 20 20 20 | 3a 74 65 78 74 20 22 42 | |:text "B|
|000036d0| 31 22 20 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |1" . | |
|000036e0| 20 20 20 20 20 20 20 20 | 20 3a 70 61 72 65 6e 74 | | :parent|
|000036f0| 20 66 29 29 0a 20 20 20 | 20 28 64 65 66 69 6e 65 | f)). | (define|
|00003700| 20 62 32 20 28 6d 61 6b | 65 20 3c 42 75 74 74 6f | b2 (mak|e <Butto|
|00003710| 6e 3e 20 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |n> . | |
|00003720| 20 20 20 20 20 20 20 20 | 20 3a 74 65 78 74 20 22 | | :text "|
|00003730| 42 32 22 20 0a 20 20 20 | 20 20 20 20 20 20 20 20 |B2" . | |
|00003740| 20 20 20 20 20 20 20 20 | 20 20 3a 70 61 72 65 6e | | :paren|
|00003750| 74 20 66 29 29 0a 5c 65 | 6e 64 7b 76 65 72 62 61 |t f)).\e|nd{verba|
|00003760| 74 69 6d 7d 0a 7d 0a 43 | 72 65 61 74 65 64 20 62 |tim}.}.C|reated b|
|00003770| 75 74 74 6f 6e 73 20 68 | 65 72 65 20 73 70 65 63 |uttons h|ere spec|
|00003780| 69 66 79 20 74 68 61 74 | 20 74 68 65 69 72 20 70 |ify that| their p|
|00003790| 61 72 65 6e 74 20 69 73 | 20 74 68 65 20 66 72 61 |arent is| the fra|
|000037a0| 6d 65 20 7b 5c 74 74 20 | 66 7d 2e 20 53 69 6e 63 |me {\tt |f}. Sinc|
|000037b0| 65 0a 74 68 69 73 20 66 | 72 61 6d 65 20 64 6f 65 |e.this f|rame doe|
|000037c0| 73 20 6e 6f 74 20 73 70 | 65 63 69 66 79 20 61 20 |s not sp|ecify a |
|000037d0| 70 61 72 74 69 63 75 6c | 61 72 20 70 61 72 65 6e |particul|ar paren|
|000037e0| 74 2c 20 69 74 20 69 73 | 20 73 75 70 70 6f 73 65 |t, it is| suppose|
|000037f0| 64 20 74 6f 20 62 65 20 | 61 20 64 69 72 65 63 74 |d to be |a direct|
|00003800| 0a 64 65 73 63 65 6e 64 | 61 6e 74 20 6f 66 20 74 |.descend|ant of t|
|00003810| 68 65 20 72 6f 6f 74 20 | 77 69 6e 64 6f 77 20 7b |he root |window {|
|00003820| 5c 74 74 20 22 2e 22 7d | 2e 20 54 68 69 73 20 70 |\tt "."}|. This p|
|00003830| 61 72 65 6e 74 27 73 20 | 6e 6f 74 69 6f 6e 20 69 |arent's |notion i|
|00003840| 73 20 61 6c 73 6f 20 75 | 73 65 64 20 66 6f 72 0a |s also u|sed for.|
|00003850| 63 61 6e 76 61 73 20 69 | 74 65 6d 73 3a 20 61 20 |canvas i|tems: a |
|00003860| 63 61 6e 76 61 73 20 69 | 74 65 6d 20 69 73 20 63 |canvas i|tem is c|
|00003870| 6f 6e 73 69 64 65 72 65 | 64 20 61 73 20 61 20 73 |onsidere|d as a s|
|00003880| 6f 6e 20 6f 66 20 74 68 | 65 20 63 61 6e 76 61 73 |on of th|e canvas|
|00003890| 20 77 68 69 63 68 20 63 | 6f 6e 74 61 69 6e 73 0a | which c|ontains.|
|000038a0| 69 74 2e 20 46 6f 72 20 | 69 6e 73 74 61 6e 63 65 |it. For |instance|
|000038b0| 2c 0a 7b 5c 73 6d 61 6c | 6c 0a 5c 62 65 67 69 6e |,.{\smal|l.\begin|
|000038c0| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 20 20 20 20 28 |{verbati|m}. (|
|000038d0| 64 65 66 69 6e 65 20 63 | 20 28 6d 61 6b 65 20 3c |define c| (make <|
|000038e0| 43 61 6e 76 61 73 3e 29 | 29 0a 20 20 20 20 28 64 |Canvas>)|). (d|
|000038f0| 65 66 69 6e 65 20 72 20 | 28 6d 61 6b 65 20 3c 52 |efine r |(make <R|
|00003900| 65 63 74 61 6e 67 6c 65 | 3e 20 0a 20 20 20 20 20 |ectangle|> . |
|00003910| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 3a | | :|
|00003920| 70 61 72 65 6e 74 20 63 | 20 0a 20 20 20 20 20 20 |parent c| . |
|00003930| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 3a 63 | | :c|
|00003940| 6f 6f 72 64 73 20 27 28 | 30 20 30 20 35 30 20 35 |oords '(|0 0 50 5|
|00003950| 30 29 29 29 0a 5c 65 6e | 64 7b 76 65 72 62 61 74 |0))).\en|d{verbat|
|00003960| 69 6d 7d 0a 7d 0a 5c 6e | 6f 69 6e 64 65 6e 74 0a |im}.}.\n|oindent.|
|00003970| 64 65 66 69 6e 65 73 20 | 61 20 72 65 63 74 61 6e |defines |a rectan|
|00003980| 67 6c 65 20 63 61 6c 6c | 65 64 20 7b 5c 74 74 20 |gle call|ed {\tt |
|00003990| 72 7d 20 69 6e 20 74 68 | 65 20 7b 5c 74 74 20 63 |r} in th|e {\tt c|
|000039a0| 7d 20 63 61 6e 76 61 73 | 2e 20 55 73 65 72 20 63 |} canvas|. User c|
|000039b0| 61 6e 20 6e 6f 77 20 66 | 6f 72 67 65 74 20 0a 74 |an now f|orget .t|
|000039c0| 68 61 74 20 7b 5c 74 74 | 20 72 7d 20 69 73 20 69 |hat {\tt| r} is i|
|000039d0| 6e 63 6c 75 64 65 64 20 | 69 6e 20 7b 5c 74 74 20 |ncluded |in {\tt |
|000039e0| 63 7d 20 73 69 6e 63 65 | 20 74 68 69 73 20 69 6e |c} since| this in|
|000039f0| 66 6f 72 6d 61 74 69 6f | 6e 20 69 73 20 65 6d 62 |formatio|n is emb|
|00003a00| 65 64 64 65 64 20 69 6e | 20 74 68 65 20 0a 53 63 |edded in| the .Sc|
|00003a10| 68 65 6d 65 20 6f 62 6a | 65 63 74 2e 20 54 6f 20 |heme obj|ect. To |
|00003a20| 6d 6f 76 65 20 74 68 69 | 73 0a 72 65 63 74 61 6e |move thi|s.rectan|
|00003a30| 67 6c 65 2c 20 6f 6e 65 | 20 63 61 6e 20 75 73 65 |gle, one| can use|
|00003a40| 20 66 6f 72 20 65 78 61 | 6d 70 6c 65 20 74 68 65 | for exa|mple the|
|00003a50| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 65 78 70 72 65 | followi|ng expre|
|00003a60| 73 73 69 6f 6e 3a 0a 7b | 5c 73 6d 61 6c 6c 0a 5c |ssion:.{|\small.\|
|00003a70| 62 65 67 69 6e 7b 76 65 | 72 62 61 74 69 6d 7d 0a |begin{ve|rbatim}.|
|00003a80| 20 20 20 20 28 6d 6f 76 | 65 20 72 20 31 30 20 31 | (mov|e r 10 1|
|00003a90| 30 29 0a 5c 65 6e 64 7b | 76 65 72 62 61 74 69 6d |0).\end{|verbatim|
|00003aa0| 7d 0a 7d 0a 5c 6e 6f 69 | 6e 64 65 6e 74 0a 77 68 |}.}.\noi|ndent.wh|
|00003ab0| 69 63 68 20 69 73 20 6d | 6f 72 65 20 6e 61 74 75 |ich is m|ore natu|
|00003ac0| 72 61 6c 20 74 68 61 6e | 20 74 68 65 20 74 68 69 |ral than| the thi|
|00003ad0| 6e 67 73 20 77 65 20 68 | 61 76 65 20 74 6f 20 64 |ngs we h|ave to d|
|00003ae0| 6f 20 61 74 20 5c 73 74 | 6b 20 66 69 72 73 74 20 |o at \st|k first |
|00003af0| 6c 65 76 65 6c 2e 0a 0a | 5c 73 75 62 73 65 63 74 |level...|\subsect|
|00003b00| 69 6f 6e 7b 47 65 6e 65 | 72 69 63 20 66 75 6e 63 |ion{Gene|ric func|
|00003b10| 74 69 6f 6e 73 7d 0a 0a | 57 69 74 68 20 74 68 65 |tions}..|With the|
|00003b20| 20 5c 73 74 6b 20 6f 62 | 6a 65 63 74 20 6c 61 79 | \stk ob|ject lay|
|00003b30| 65 72 2c 20 65 78 65 63 | 75 74 69 6f 6e 20 6f 66 |er, exec|ution of|
|00003b40| 20 61 20 6d 65 74 68 6f | 64 20 64 6f 65 73 6e 27 | a metho|d doesn'|
|00003b50| 74 20 75 73 65 20 74 68 | 65 20 63 6c 61 73 73 69 |t use th|e classi|
|00003b60| 63 61 6c 0a 6d 65 73 73 | 61 67 65 20 73 65 6e 64 |cal.mess|age send|
|00003b70| 69 6e 67 20 6d 65 63 68 | 61 6e 69 73 6d 20 61 73 |ing mech|anism as|
|00003b80| 20 69 6e 20 6e 75 6d 65 | 72 6f 75 73 20 6f 62 6a | in nume|rous obj|
|00003b90| 65 63 74 20 6c 61 6e 67 | 75 61 67 65 73 20 62 75 |ect lang|uages bu|
|00003ba0| 74 20 67 65 6e 65 72 69 | 63 0a 66 75 6e 63 74 69 |t generi|c.functi|
|00003bb0| 6f 6e 73 2e 20 54 68 65 | 20 6d 65 63 68 61 6e 69 |ons. The| mechani|
|00003bc0| 73 6d 20 69 6d 70 6c 65 | 6d 65 6e 74 65 64 20 69 |sm imple|mented i|
|00003bd0| 6e 20 5c 73 74 6b 20 69 | 73 20 61 20 73 75 62 73 |n \stk i|s a subs|
|00003be0| 65 74 20 6f 66 20 74 68 | 65 20 67 65 6e 65 72 69 |et of th|e generi|
|00003bf0| 63 0a 66 75 6e 63 74 69 | 6f 6e 73 20 6f 66 20 43 |c.functi|ons of C|
|00003c00| 4c 4f 53 2e 20 41 73 20 | 69 6e 20 43 4c 4f 53 2c |LOS. As |in CLOS,|
|00003c10| 20 61 20 67 65 6e 65 72 | 69 63 20 66 75 6e 63 74 | a gener|ic funct|
|00003c20| 69 6f 6e 20 63 61 6e 20 | 68 61 76 65 20 73 65 76 |ion can |have sev|
|00003c30| 65 72 61 6c 20 6d 65 74 | 68 6f 64 73 0a 61 73 73 |eral met|hods.ass|
|00003c40| 6f 63 69 61 74 65 64 20 | 77 69 74 68 20 69 74 2e |ociated |with it.|
|00003c50| 20 54 68 65 73 65 20 6d | 65 74 68 6f 64 73 20 64 | These m|ethods d|
|00003c60| 65 73 63 72 69 62 65 20 | 74 68 65 20 67 65 6e 65 |escribe |the gene|
|00003c70| 72 69 63 20 66 75 6e 63 | 74 69 6f 6e 20 62 65 68 |ric func|tion beh|
|00003c80| 61 76 69 6f 75 72 0a 61 | 63 63 6f 72 64 69 6e 67 |aviour.a|ccording|
|00003c90| 20 74 6f 20 74 68 65 20 | 74 79 70 65 20 6f 66 20 | to the |type of |
|00003ca0| 69 74 73 20 70 61 72 61 | 6d 65 74 65 72 73 2e 20 |its para|meters. |
|00003cb0| 41 20 6d 65 74 68 6f 64 | 20 66 6f 72 20 61 20 67 |A method| for a g|
|00003cc0| 65 6e 65 72 69 63 20 66 | 75 6e 63 74 69 6f 6e 20 |eneric f|unction |
|00003cd0| 69 73 0a 64 65 66 69 6e | 65 64 20 77 69 74 68 20 |is.defin|ed with |
|00003ce0| 74 68 65 20 7b 5c 65 6d | 20 64 65 66 69 6e 65 2d |the {\em| define-|
|00003cf0| 6d 65 74 68 6f 64 7d 20 | 66 6f 72 6d 2e 0a 0a 46 |method} |form...F|
|00003d00| 6f 6c 6c 6f 77 69 6e 67 | 20 65 78 61 6d 70 6c 65 |ollowing| example|
|00003d10| 20 73 68 6f 77 73 20 74 | 68 72 65 65 20 6d 65 74 | shows t|hree met|
|00003d20| 68 6f 64 73 20 6f 66 20 | 74 68 65 20 67 65 6e 65 |hods of |the gene|
|00003d30| 72 69 63 20 66 75 6e 63 | 74 69 6f 6e 20 7b 5c 74 |ric func|tion {\t|
|00003d40| 74 20 76 61 6c 75 65 2d | 6f 66 7d 3a 0a 7b 5c 73 |t value-|of}:.{\s|
|00003d50| 6d 61 6c 6c 0a 5c 62 65 | 67 69 6e 7b 76 65 72 62 |mall.\be|gin{verb|
|00003d60| 61 74 69 6d 7d 0a 20 20 | 20 28 64 65 66 69 6e 65 |atim}. | (define|
|00003d70| 2d 6d 65 74 68 6f 64 20 | 76 61 6c 75 65 2d 6f 66 |-method |value-of|
|00003d80| 20 28 28 6f 62 6a 20 3c | 53 63 61 6c 65 3e 29 29 | ((obj <|Scale>))|
|00003d90| 0a 20 20 20 20 20 28 73 | 74 72 69 6e 67 2d 3e 6e |. (s|tring->n|
|00003da0| 75 6d 62 65 72 20 28 28 | 49 64 20 6f 62 6a 29 20 |umber ((|Id obj) |
|00003db0| 27 67 65 74 29 29 29 0a | 0a 20 20 20 28 64 65 66 |'get))).|. (def|
|00003dc0| 69 6e 65 2d 6d 65 74 68 | 6f 64 20 76 61 6c 75 65 |ine-meth|od value|
|00003dd0| 2d 6f 66 20 28 28 6f 62 | 6a 20 3c 45 6e 74 72 79 |-of ((ob|j <Entry|
|00003de0| 3e 29 29 0a 20 20 20 20 | 20 28 28 49 64 20 6f 62 |>)). | ((Id ob|
|00003df0| 6a 29 20 27 67 65 74 29 | 29 0a 20 20 20 20 0a 20 |j) 'get)|). . |
|00003e00| 20 20 28 64 65 66 69 6e | 65 2d 6d 65 74 68 6f 64 | (defin|e-method|
|00003e10| 20 76 61 6c 75 65 2d 6f | 66 20 28 6f 62 6a 29 0a | value-o|f (obj).|
|00003e20| 20 20 20 20 20 28 65 72 | 72 6f 72 20 22 42 61 64 | (er|ror "Bad|
|00003e30| 20 63 61 6c 6c 3a 20 22 | 20 6f 62 6a 29 29 0a 5c | call: "| obj)).\|
|00003e40| 65 6e 64 7b 76 65 72 62 | 61 74 69 6d 7d 0a 7d 0a |end{verb|atim}.}.|
|00003e50| 5c 6e 6f 69 6e 64 65 6e | 74 0a 57 68 65 6e 20 63 |\noinden|t.When c|
|00003e60| 61 6c 6c 69 6e 67 20 74 | 68 65 20 7b 5c 74 74 20 |alling t|he {\tt |
|00003e70| 76 61 6c 75 65 2d 6f 66 | 7d 20 67 65 6e 65 72 69 |value-of|} generi|
|00003e80| 63 20 66 75 6e 63 74 69 | 6f 6e 2c 20 73 79 73 74 |c functi|on, syst|
|00003e90| 65 6d 20 77 69 6c 6c 20 | 63 68 6f 6f 73 65 20 0a |em will |choose .|
|00003ea0| 74 68 65 20 6d 6f 72 65 | 20 61 64 65 71 75 61 74 |the more| adequat|
|00003eb0| 65 20 6d 65 74 68 6f 64 | 2c 20 61 63 63 6f 72 64 |e method|, accord|
|00003ec0| 69 6e 67 20 74 6f 20 69 | 74 73 20 70 61 72 61 6d |ing to i|ts param|
|00003ed0| 65 74 65 72 20 74 79 70 | 65 3a 20 69 66 20 70 61 |eter typ|e: if pa|
|00003ee0| 72 61 6d 65 74 65 72 20 | 69 73 20 61 0a 73 63 61 |rameter |is a.sca|
|00003ef0| 6c 65 20 6f 72 20 61 6e | 20 65 6e 74 72 79 2c 20 |le or an| entry, |
|00003f00| 66 69 72 73 74 20 20 6f | 72 20 73 65 63 6f 6e 64 |first o|r second|
|00003f10| 20 6d 65 74 68 6f 64 20 | 69 73 20 63 61 6c 6c 65 | method |is calle|
|00003f20| 64 3b 20 6f 74 68 65 72 | 77 69 73 65 20 74 68 65 |d; other|wise the|
|00003f30| 20 74 68 69 72 64 0a 6d | 65 74 68 6f 64 20 69 73 | third.m|ethod is|
|00003f40| 20 63 61 6c 6c 65 64 20 | 73 69 6e 63 65 20 69 74 | called |since it|
|00003f50| 20 64 6f 65 73 6e 27 74 | 20 64 69 73 63 72 69 6d | doesn't| discrim|
|00003f60| 69 6e 61 74 65 73 20 69 | 6e 20 66 61 76 6f 75 72 |inates i|n favour|
|00003f70| 20 6f 66 20 61 20 70 61 | 72 74 69 63 75 6c 61 72 | of a pa|rticular|
|00003f80| 0a 70 61 72 61 6d 65 74 | 65 72 20 74 79 70 65 2e |.paramet|er type.|
|00003f90| 0a 0a 53 65 74 74 65 72 | 20 6d 65 74 68 6f 64 20 |..Setter| method |
|00003fa0| 61 72 65 20 61 20 73 70 | 65 63 69 61 6c 20 6b 69 |are a sp|ecial ki|
|00003fb0| 6e 64 20 6f 66 20 6d 65 | 74 68 6f 64 73 20 77 68 |nd of me|thods wh|
|00003fc0| 69 63 68 20 61 72 65 20 | 75 73 65 64 20 77 69 74 |ich are |used wit|
|00003fd0| 68 20 74 68 65 0a 67 65 | 6e 65 72 61 6c 69 7a 65 |h the.ge|neralize|
|00003fe0| 64 20 7b 5c 74 74 20 73 | 65 74 21 7d 2e 20 48 65 |d {\tt s|et!}. He|
|00003ff0| 72 65 20 61 72 65 20 74 | 68 65 20 63 6f 72 72 65 |re are t|he corre|
|00004000| 73 70 6f 6e 64 69 6e 67 | 20 73 65 74 74 65 72 20 |sponding| setter |
|00004010| 6d 65 74 68 6f 64 73 20 | 74 6f 20 70 72 65 76 69 |methods |to previ|
|00004020| 6f 75 73 20 0a 7b 5c 74 | 74 20 76 61 6c 75 65 2d |ous .{\t|t value-|
|00004030| 6f 66 7d 3a 0a 7b 5c 73 | 6d 61 6c 6c 0a 5c 62 65 |of}:.{\s|mall.\be|
|00004040| 67 69 6e 7b 76 65 72 62 | 61 74 69 6d 7d 0a 20 20 |gin{verb|atim}. |
|00004050| 20 20 28 64 65 66 69 6e | 65 2d 6d 65 74 68 6f 64 | (defin|e-method|
|00004060| 20 28 73 65 74 74 65 72 | 20 76 61 6c 75 65 2d 6f | (setter| value-o|
|00004070| 66 29 0a 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |f). | |
|00004080| 20 20 20 20 20 20 28 28 | 6f 62 6a 20 3c 53 63 61 | ((|obj <Sca|
|00004090| 6c 65 3e 29 20 76 61 6c | 75 65 29 0a 20 20 20 20 |le>) val|ue). |
|000040a0| 20 20 28 28 49 64 20 6f | 62 6a 29 20 27 73 65 74 | ((Id o|bj) 'set|
|000040b0| 20 76 61 6c 75 65 29 29 | 0a 0a 20 20 20 20 28 64 | value))|.. (d|
|000040c0| 65 66 69 6e 65 2d 6d 65 | 74 68 6f 64 20 28 73 65 |efine-me|thod (se|
|000040d0| 74 74 65 72 20 76 61 6c | 75 65 2d 6f 66 29 0a 20 |tter val|ue-of). |
|000040e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000040f0| 20 20 28 28 6f 62 6a 20 | 3c 45 6e 74 72 79 3e 29 | ((obj |<Entry>)|
|00004100| 20 76 61 6c 75 65 29 0a | 20 20 20 20 20 20 28 28 | value).| ((|
|00004110| 49 64 20 6f 62 6a 29 20 | 27 64 65 6c 65 74 65 20 |Id obj) |'delete |
|00004120| 30 20 27 65 6e 64 29 0a | 20 20 20 20 20 20 28 28 |0 'end).| ((|
|00004130| 49 64 20 6f 62 6a 29 20 | 27 69 6e 73 65 72 74 20 |Id obj) |'insert |
|00004140| 30 20 76 61 6c 75 65 29 | 29 0a 20 20 20 20 0a 20 |0 value)|). . |
|00004150| 20 20 20 28 64 65 66 69 | 6e 65 2d 6d 65 74 68 6f | (defi|ne-metho|
|00004160| 64 20 28 73 65 74 74 65 | 72 20 76 61 6c 75 65 2d |d (sette|r value-|
|00004170| 6f 66 29 20 28 6f 62 6a | 29 0a 20 20 20 20 20 20 |of) (obj|). |
|00004180| 28 65 72 72 6f 72 20 22 | 42 61 64 20 63 61 6c 6c |(error "|Bad call|
|00004190| 3a 20 22 20 6f 62 6a 29 | 29 0a 5c 65 6e 64 7b 76 |: " obj)|).\end{v|
|000041a0| 65 72 62 61 74 69 6d 7d | 0a 7d 0a 5c 6e 6f 69 6e |erbatim}|.}.\noin|
|000041b0| 64 65 6e 74 0a 4f 6e 65 | 20 6f 66 20 74 68 65 73 |dent.One| of thes|
|000041c0| 65 20 6d 65 74 68 6f 64 | 73 20 77 69 6c 6c 20 62 |e method|s will b|
|000041d0| 65 20 63 61 6c 6c 65 64 | 20 77 68 65 6e 20 65 76 |e called| when ev|
|000041e0| 61 6c 75 61 74 69 6e 67 | 20 66 6f 6c 6c 6f 77 69 |aluating| followi|
|000041f0| 6e 67 20 66 6f 72 6d 2c | 20 64 65 70 65 6e 64 69 |ng form,| dependi|
|00004200| 6e 67 0a 6f 66 20 74 79 | 70 65 20 6f 66 20 7b 5c |ng.of ty|pe of {\|
|00004210| 74 74 20 78 7d 3a 0a 7b | 5c 73 6d 61 6c 6c 0a 5c |tt x}:.{|\small.\|
|00004220| 62 65 67 69 6e 7b 76 65 | 72 62 61 74 69 6d 7d 0a |begin{ve|rbatim}.|
|00004230| 20 20 20 20 28 73 65 74 | 21 20 28 76 61 6c 75 65 | (set|! (value|
|00004240| 2d 6f 66 20 78 29 20 31 | 30 30 29 0a 5c 65 6e 64 |-of x) 1|00).\end|
|00004250| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 7d 0a 5c 6e 6f |{verbati|m}.}.\no|
|00004260| 69 6e 64 65 6e 74 0a 41 | 73 20 77 65 20 63 61 6e |indent.A|s we can|
|00004270| 20 73 65 65 20 68 65 72 | 65 2c 20 67 65 6e 65 72 | see her|e, gener|
|00004280| 69 63 20 66 75 6e 63 74 | 69 6f 6e 73 20 79 69 65 |ic funct|ions yie|
|00004290| 6c 64 20 74 68 69 6e 67 | 73 20 6d 6f 72 65 20 68 |ld thing|s more h|
|000042a0| 6f 6d 6f 67 65 6e 65 6f | 75 73 20 74 68 61 6e 20 |omogeneo|us than |
|000042b0| 77 68 61 74 0a 77 65 20 | 63 61 6e 20 68 61 76 65 |what.we |can have|
|000042c0| 20 61 74 20 5c 73 74 6b | 20 66 69 72 73 74 20 6c | at \stk| first l|
|000042d0| 65 76 65 6c 2e 20 49 6e | 64 65 65 64 20 67 65 74 |evel. In|deed get|
|000042e0| 74 69 6e 67 20 61 6e 64 | 20 73 65 74 74 69 6e 67 |ting and| setting|
|000042f0| 20 74 68 65 20 76 61 6c | 75 65 20 6f 66 20 61 6e | the val|ue of an|
|00004300| 0a 65 6e 74 72 79 20 6f | 72 20 61 20 73 63 61 6c |.entry o|r a scal|
|00004310| 65 20 63 61 6e 20 6e 6f | 77 20 62 65 20 64 6f 6e |e can no|w be don|
|00004320| 65 20 69 6e 20 61 20 73 | 69 6d 69 6c 61 72 20 66 |e in a s|imilar f|
|00004330| 61 73 68 69 6f 6e 20 77 | 69 74 68 20 74 68 6f 73 |ashion w|ith thos|
|00004340| 65 20 6d 65 74 68 6f 64 | 73 2e 0a 0a 5c 73 65 63 |e method|s...\sec|
|00004350| 74 69 6f 6e 7b 49 6d 70 | 6c 65 6d 65 6e 74 61 74 |tion{Imp|lementat|
|00004360| 69 6f 6e 20 2d 20 50 65 | 72 66 6f 72 6d 61 6e 63 |ion - Pe|rformanc|
|00004370| 65 73 7d 0a 54 68 65 20 | 5c 73 74 6b 20 69 6e 74 |es}.The |\stk int|
|00004380| 65 72 70 72 65 74 65 72 | 20 69 73 20 77 72 69 74 |erpreter| is writ|
|00004390| 74 65 6e 20 69 6e 20 43 | 20 61 6e 64 20 66 6f 72 |ten in C| and for|
|000043a0| 20 73 6f 6d 65 20 70 61 | 72 74 73 20 69 6e 20 53 | some pa|rts in S|
|000043b0| 63 68 65 6d 65 2e 20 54 | 68 65 20 6f 62 6a 65 63 |cheme. T|he objec|
|000043c0| 74 0a 6f 72 69 65 6e 74 | 65 64 20 6c 61 79 65 72 |t.orient|ed layer|
|000043d0| 20 70 72 65 73 65 6e 74 | 65 64 20 69 6e 20 73 65 | present|ed in se|
|000043e0| 63 74 69 6f 6e 20 33 20 | 69 73 20 74 6f 74 61 6c |ction 3 |is total|
|000043f0| 6c 79 20 77 72 69 74 74 | 65 6e 20 69 6e 20 53 63 |ly writt|en in Sc|
|00004400| 68 65 6d 65 2e 20 20 54 | 68 65 0a 53 63 68 65 6d |heme. T|he.Schem|
|00004410| 65 20 69 6e 74 65 72 70 | 72 65 74 65 72 20 69 73 |e interp|reter is|
|00004420| 20 61 73 20 66 61 72 20 | 61 73 20 70 6f 73 73 69 | as far |as possi|
|00004430| 62 6c 65 20 63 6f 6e 66 | 6f 72 6d 20 77 69 74 68 |ble conf|orm with|
|00004440| 20 52 34 52 53 20 5c 63 | 69 74 65 7b 52 34 52 53 | R4RS \c|ite{R4RS|
|00004450| 7d 2e 20 49 74 0a 69 73 | 20 69 6d 70 6f 72 74 61 |}. It.is| importa|
|00004460| 6e 74 20 74 6f 20 6e 6f | 74 65 20 74 68 61 74 20 |nt to no|te that |
|00004470| 74 68 65 20 54 6b 20 6c | 69 62 72 61 72 79 20 69 |the Tk l|ibrary i|
|00004480| 73 20 75 73 65 64 20 75 | 6e 6d 6f 64 69 66 69 65 |s used u|nmodifie|
|00004490| 64 20 69 6e 20 74 68 69 | 73 0a 69 6e 74 65 72 70 |d in thi|s.interp|
|000044a0| 72 65 74 65 72 2e 20 20 | 41 6c 6c 20 74 68 65 20 |reter. |All the |
|000044b0| 54 63 6c 20 66 75 6e 63 | 74 69 6f 6e 73 20 63 61 |Tcl func|tions ca|
|000044c0| 6c 6c 20 69 73 73 75 65 | 64 20 62 79 20 54 6b 20 |ll issue|d by Tk |
|000044d0| 70 72 69 6d 69 74 69 76 | 65 73 20 61 72 65 20 73 |primitiv|es are s|
|000044e0| 69 6d 75 6c 61 74 65 64 | 0a 62 79 20 5c 73 74 6b |imulated|.by \stk|
|000044f0| 2e 20 20 54 68 69 73 20 | 70 65 72 6d 69 74 73 20 |. This |permits |
|00004500| 74 6f 20 74 68 65 20 5c | 73 74 6b 20 69 6e 74 65 |to the \|stk inte|
|00004510| 72 70 72 65 74 65 72 20 | 74 6f 20 62 65 2c 20 61 |rpreter |to be, a|
|00004520| 73 20 66 61 72 20 61 73 | 20 70 6f 73 73 69 62 6c |s far as| possibl|
|00004530| 65 2c 0a 69 6e 64 65 70 | 65 6e 64 65 6e 74 20 6f |e,.indep|endent o|
|00004540| 66 20 74 68 65 20 54 6b | 20 63 6f 64 65 2e 20 49 |f the Tk| code. I|
|00004550| 6e 20 70 61 72 74 69 63 | 75 6c 61 72 2c 20 65 6d |n partic|ular, em|
|00004560| 62 65 64 64 69 6e 67 20 | 61 20 6e 65 77 20 72 65 |bedding |a new re|
|00004570| 6c 65 61 73 65 20 6f 66 | 20 54 6b 20 77 69 6c 6c |lease of| Tk will|
|00004580| 0a 6f 6e 6c 79 20 72 65 | 71 75 69 72 65 20 74 6f |.only re|quire to|
|00004590| 20 6c 69 6e 6b 20 74 68 | 65 20 6e 65 77 20 6c 69 | link th|e new li|
|000045a0| 62 72 61 72 79 20 74 6f | 20 74 68 65 20 61 63 74 |brary to| the act|
|000045b0| 75 61 6c 20 7b 5c 73 74 | 6b 7d 0a 69 6e 74 65 72 |ual {\st|k}.inter|
|000045c0| 70 72 65 74 65 72 2e 20 | 46 75 72 74 68 65 72 6d |preter. |Furtherm|
|000045d0| 6f 72 65 2c 20 65 78 74 | 65 72 6e 61 6c 20 63 6f |ore, ext|ernal co|
|000045e0| 6e 74 72 69 62 75 74 69 | 6f 6e 73 20 77 65 20 63 |ntributi|ons we c|
|000045f0| 61 6e 20 66 69 6e 64 20 | 6f 6e 20 6e 65 74 20 63 |an find |on net c|
|00004600| 61 6e 20 62 65 0a 65 61 | 73 69 6c 79 20 69 6e 63 |an be.ea|sily inc|
|00004610| 6c 75 64 65 64 20 69 6e | 20 74 68 65 20 69 6e 74 |luded in| the int|
|00004620| 65 72 70 72 65 74 65 72 | 2c 20 73 69 6e 63 65 20 |erpreter|, since |
|00004630| 54 63 6c 20 60 60 69 6e | 74 72 69 6e 73 69 63 73 |Tcl ``in|trinsics|
|00004640| 27 27 20 72 65 70 6c 61 | 63 65 6d 65 6e 74 73 20 |'' repla|cements |
|00004650| 61 72 65 0a 70 72 65 73 | 65 6e 74 20 69 6e 20 74 |are.pres|ent in t|
|00004660| 68 65 20 5c 73 74 6b 20 | 63 6f 72 65 2e 0a 0a 41 |he \stk |core...A|
|00004670| 63 74 75 61 6c 20 69 6d | 70 6c 65 6d 65 6e 74 61 |ctual im|plementa|
|00004680| 74 69 6f 6e 20 64 6f 65 | 73 6e 27 74 20 70 75 74 |tion doe|sn't put|
|00004690| 20 61 63 63 65 6e 74 20 | 6f 6e 20 70 65 72 66 6f | accent |on perfo|
|000046a0| 72 6d 61 6e 63 65 73 2e | 20 49 74 20 6d 75 73 74 |rmances.| It must|
|000046b0| 20 62 65 20 73 65 65 6e | 20 61 73 20 61 0a 70 72 | be seen| as a.pr|
|000046c0| 6f 74 6f 74 79 70 65 20 | 77 68 69 63 68 20 6d 75 |ototype |which mu|
|000046d0| 73 74 20 62 65 20 73 74 | 72 65 74 63 68 65 64 20 |st be st|retched |
|000046e0| 66 75 72 74 68 65 72 2e | 20 48 6f 77 65 76 65 72 |further.| However|
|000046f0| 2c 20 6d 65 61 73 75 72 | 69 6e 67 20 74 68 65 20 |, measur|ing the |
|00004700| 70 65 72 66 6f 72 6d 61 | 6e 63 65 73 0a 6f 66 20 |performa|nces.of |
|00004710| 74 68 65 20 5c 73 74 6b | 20 70 61 63 6b 61 67 65 |the \stk| package|
|00004720| 20 69 73 20 61 20 64 69 | 66 66 69 63 75 6c 74 20 | is a di|fficult |
|00004730| 74 61 73 6b 20 61 6e 64 | 20 68 61 73 20 6e 6f 74 |task and| has not|
|00004740| 20 62 65 65 6e 20 72 65 | 61 6c 6c 79 20 64 6f 6e | been re|ally don|
|00004750| 65 20 79 65 74 2e 20 57 | 68 61 74 0a 77 65 20 63 |e yet. W|hat.we c|
|00004760| 61 6e 20 73 61 79 20 66 | 6f 72 20 6e 6f 77 20 69 |an say f|or now i|
|00004770| 73 20 74 68 61 74 20 74 | 68 65 72 65 20 69 73 20 |s that t|here is |
|00004780| 61 20 6c 69 74 74 6c 65 | 20 6f 76 65 72 68 65 61 |a little| overhea|
|00004790| 64 20 77 68 65 6e 20 63 | 61 6c 6c 69 6e 67 20 61 |d when c|alling a|
|000047a0| 20 54 6b 0a 70 72 69 6d | 69 74 69 76 65 20 77 72 | Tk.prim|itive wr|
|000047b0| 69 74 74 65 6e 20 69 6e | 20 43 20 73 69 6e 63 65 |itten in| C since|
|000047c0| 20 74 68 65 20 5c 73 74 | 6b 20 70 61 63 6b 61 67 | the \st|k packag|
|000047d0| 65 20 6d 75 73 74 20 74 | 72 61 6e 73 6c 61 74 65 |e must t|ranslate|
|000047e0| 20 61 6c 6c 20 74 68 65 | 0a 70 61 72 61 6d 65 74 | all the|.paramet|
|000047f0| 65 72 73 20 69 6e 20 43 | 20 73 74 72 69 6e 67 73 |ers in C| strings|
|00004800| 2e 20 54 68 69 73 20 74 | 72 61 6e 73 6c 61 74 69 |. This t|ranslati|
|00004810| 6f 6e 20 6d 75 73 74 20 | 62 65 20 64 6f 6e 65 20 |on must |be done |
|00004820| 62 65 63 61 75 73 65 20 | 74 68 65 20 54 6b 20 6c |because |the Tk l|
|00004830| 69 62 72 61 72 79 0a 60 | 60 74 68 69 6e 6b 73 27 |ibrary.`|`thinks'|
|00004840| 27 20 74 68 61 74 20 69 | 74 20 77 6f 72 6b 73 20 |' that i|t works |
|00004850| 6f 6e 20 54 63 6c 20 77 | 68 69 63 68 20 75 73 65 |on Tcl w|hich use|
|00004860| 73 20 73 74 72 69 6e 67 | 73 20 66 6f 72 20 70 61 |s string|s for pa|
|00004870| 73 73 69 6e 67 20 70 61 | 72 61 6d 65 74 65 72 73 |ssing pa|rameters|
|00004880| 2e 20 49 6e 0a 63 6f 75 | 6e 74 65 72 70 61 72 74 |. In.cou|nterpart|
|00004890| 2c 20 70 72 6f 63 65 64 | 75 72 65 20 77 72 69 74 |, proced|ure writ|
|000048a0| 74 65 6e 20 69 6e 20 53 | 63 68 65 6d 65 20 61 72 |ten in S|cheme ar|
|000048b0| 65 20 66 61 72 20 6d 6f | 72 65 20 65 66 66 69 63 |e far mo|re effic|
|000048c0| 69 65 6e 74 20 74 68 61 | 6e 20 54 63 6c 0a 73 63 |ient tha|n Tcl.sc|
|000048d0| 72 69 70 74 73 20 73 69 | 6e 63 65 20 74 68 65 20 |ripts si|nce the |
|000048e0| 53 63 68 65 6d 65 20 69 | 6e 74 65 72 70 72 65 74 |Scheme i|nterpret|
|000048f0| 65 72 20 75 73 65 73 20 | 61 6e 20 61 70 70 72 6f |er uses |an appro|
|00004900| 70 72 69 61 74 65 20 66 | 6f 72 6d 61 74 20 77 68 |priate f|ormat wh|
|00004910| 69 63 68 20 69 73 0a 63 | 68 65 61 70 65 72 20 74 |ich is.c|heaper t|
|00004920| 68 61 6e 20 73 74 72 69 | 6e 67 73 2e 20 49 6e 20 |han stri|ngs. In |
|00004930| 70 61 72 74 69 63 75 6c | 61 72 2c 20 74 68 65 72 |particul|ar, ther|
|00004940| 65 20 69 73 20 6e 6f 20 | 64 61 74 61 20 63 6f 6e |e is no |data con|
|00004950| 76 65 72 73 69 6f 6e 20 | 77 68 65 6e 20 6f 74 68 |version |when oth|
|00004960| 65 72 0a 53 63 68 65 6d | 65 20 70 72 6f 63 65 64 |er.Schem|e proced|
|00004970| 75 72 65 73 20 61 72 65 | 20 63 61 6c 6c 65 64 2e |ures are| called.|
|00004980| 20 55 73 69 6e 67 20 74 | 68 65 20 6f 62 6a 65 63 | Using t|he objec|
|00004990| 74 20 65 78 74 65 6e 73 | 69 6f 6e 20 6f 66 0a 5c |t extens|ion of.\|
|000049a0| 73 74 6b 20 67 69 76 65 | 73 20 74 68 69 73 20 74 |stk give|s this t|
|000049b0| 6f 6f 6c 20 6d 6f 72 65 | 20 70 6f 77 65 72 20 62 |ool more| power b|
|000049c0| 75 74 20 69 73 2c 20 61 | 73 20 77 65 20 63 61 6e |ut is, a|s we can|
|000049d0| 20 65 78 70 65 63 74 2c | 20 6d 6f 72 65 20 74 69 | expect,| more ti|
|000049e0| 6d 65 20 63 6f 6e 73 75 | 6d 69 6e 67 2e 0a 46 6f |me consu|ming..Fo|
|000049f0| 72 20 6e 6f 77 2c 20 70 | 65 6e 61 6c 74 79 20 77 |r now, p|enalty w|
|00004a00| 68 65 6e 20 75 73 69 6e | 67 20 74 68 65 20 5c 73 |hen usin|g the \s|
|00004a10| 74 6b 20 6f 62 6a 65 63 | 74 20 6f 72 69 65 6e 74 |tk objec|t orient|
|00004a20| 65 64 20 6c 61 79 65 72 | 20 69 73 20 6d 61 69 6e |ed layer| is main|
|00004a30| 6c 79 20 64 75 65 20 74 | 6f 0a 6f 62 6a 65 63 74 |ly due t|o.object|
|00004a40| 20 63 72 65 61 74 69 6f | 6e 3a 20 63 72 65 61 74 | creatio|n: creat|
|00004a50| 69 6e 67 20 61 20 77 69 | 64 67 65 74 20 77 69 74 |ing a wi|dget wit|
|00004a60| 68 20 61 20 7b 5c 74 74 | 20 6d 61 6b 65 7d 20 69 |h a {\tt| make} i|
|00004a70| 73 20 6e 65 61 72 6c 79 | 20 32 30 20 74 69 6d 65 |s nearly| 20 time|
|00004a80| 73 20 73 6c 6f 77 65 72 | 0a 74 68 61 6e 20 62 61 |s slower|.than ba|
|00004a90| 73 69 63 20 63 72 65 61 | 74 69 6f 6e 20 61 63 68 |sic crea|tion ach|
|00004aa0| 69 65 76 65 64 20 62 79 | 20 75 73 69 6e 67 20 6f |ieved by| using o|
|00004ab0| 6e 6c 79 20 66 69 72 73 | 74 20 6c 65 76 65 6c 20 |nly firs|t level |
|00004ac0| 70 72 69 6d 69 74 69 76 | 65 73 2e 20 48 6f 77 65 |primitiv|es. Howe|
|00004ad0| 76 65 72 2c 0a 67 65 74 | 74 69 6e 67 20 6f 72 20 |ver,.get|ting or |
|00004ae0| 72 65 61 64 69 6e 67 20 | 61 20 54 6b 20 6f 70 74 |reading |a Tk opt|
|00004af0| 69 6f 6e 20 75 73 69 6e | 67 20 61 20 73 6c 6f 74 |ion usin|g a slot|
|00004b00| 20 61 63 63 65 73 73 20 | 69 73 20 6f 6e 6c 79 20 | access |is only |
|00004b10| 31 2e 35 20 74 69 6d 65 | 73 20 73 6c 6f 77 65 72 |1.5 time|s slower|
|00004b20| 0a 74 68 61 6e 20 64 69 | 72 65 63 74 20 54 6b 20 |.than di|rect Tk |
|00004b30| 63 6f 6e 66 69 67 75 72 | 61 74 69 6f 6e 2e 20 57 |configur|ation. W|
|00004b40| 65 20 63 61 6e 20 65 78 | 70 65 63 74 20 74 68 61 |e can ex|pect tha|
|00004b50| 74 20 72 65 77 72 69 74 | 69 6e 67 20 73 6f 6d 65 |t rewrit|ing some|
|00004b60| 20 70 61 72 74 73 20 6f | 66 20 74 68 65 0a 5c 73 | parts o|f the.\s|
|00004b70| 74 6b 20 6f 62 6a 65 63 | 74 20 6c 61 79 65 72 20 |tk objec|t layer |
|00004b80| 69 6e 20 43 20 77 69 6c | 6c 20 64 65 63 72 65 61 |in C wil|l decrea|
|00004b90| 73 65 20 74 68 6f 73 65 | 20 72 61 74 69 6f 73 2e |se those| ratios.|
|00004ba0| 0a 43 6f 6d 70 61 72 69 | 6e 67 20 74 68 65 20 54 |.Compari|ng the T|
|00004bb0| 63 6c 20 61 6e 64 20 53 | 63 68 65 6d 65 20 61 70 |cl and S|cheme ap|
|00004bc0| 70 72 6f 61 63 68 65 73 | 20 6e 65 65 64 73 20 6d |proaches| needs m|
|00004bd0| 75 63 68 20 6d 6f 72 65 | 20 77 6f 72 6b 69 6e 67 |uch more| working|
|00004be0| 3b 20 61 6e 64 20 61 0a | 63 6f 6d 70 6c 65 74 65 |; and a.|complete|
|00004bf0| 20 73 74 75 64 79 20 77 | 69 6c 6c 20 62 65 20 64 | study w|ill be d|
|00004c00| 6f 6e 65 20 77 68 65 6e | 20 74 68 65 20 70 61 63 |one when| the pac|
|00004c10| 6b 61 67 65 20 77 69 6c | 6c 20 62 65 20 6d 6f 72 |kage wil|l be mor|
|00004c20| 65 20 73 74 61 62 6c 65 | 2e 0a 0a 0a 5c 73 65 63 |e stable|....\sec|
|00004c30| 74 69 6f 6e 7b 4f 70 65 | 6e 20 70 72 6f 62 6c 65 |tion{Ope|n proble|
|00004c40| 6d 73 7d 0a 55 73 69 6e | 67 20 53 63 68 65 6d 65 |ms}.Usin|g Scheme|
|00004c50| 20 77 69 74 68 20 54 6b | 20 63 61 75 73 65 73 20 | with Tk| causes |
|00004c60| 73 6f 6d 65 20 64 69 66 | 66 69 63 75 6c 74 69 65 |some dif|ficultie|
|00004c70| 73 20 77 68 69 63 68 20 | 63 61 6e 6e 6f 74 20 73 |s which |cannot s|
|00004c80| 61 74 69 73 66 61 63 74 | 6f 72 69 6c 79 20 62 65 |atisfact|orily be|
|00004c90| 0a 72 65 73 6f 6c 76 65 | 64 2e 20 53 6f 6d 65 20 |.resolve|d. Some |
|00004ca0| 70 72 6f 62 6c 65 6d 73 | 20 61 72 65 20 64 75 65 |problems| are due|
|00004cb0| 20 74 6f 20 74 68 65 20 | 76 65 72 79 20 6e 61 74 | to the |very nat|
|00004cc0| 75 72 65 20 6f 66 20 53 | 63 68 65 6d 65 2c 20 6f |ure of S|cheme, o|
|00004cd0| 74 68 65 72 73 20 61 72 | 65 20 64 75 65 20 74 6f |thers ar|e due to|
|00004ce0| 0a 54 6b 2e 20 46 6f 6c | 6c 6f 77 69 6e 67 2c 20 |.Tk. Fol|lowing, |
|00004cf0| 69 73 20 61 20 6c 69 73 | 74 20 6f 66 20 6d 61 6a |is a lis|t of maj|
|00004d00| 6f 72 20 6f 66 20 74 68 | 65 6d 20 0a 5c 62 65 67 |or of th|em .\beg|
|00004d10| 69 6e 20 7b 69 74 65 6d | 69 7a 65 7d 0a 5c 69 74 |in {item|ize}.\it|
|00004d20| 65 6d 20 52 34 52 53 20 | 72 65 71 75 69 72 65 73 |em R4RS |requires|
|00004d30| 20 74 68 61 74 20 73 79 | 6d 62 6f 6c 20 6d 75 73 | that sy|mbol mus|
|00004d40| 74 20 62 65 20 63 61 73 | 65 20 69 6e 73 65 6e 73 |t be cas|e insens|
|00004d50| 69 74 69 76 65 2e 20 54 | 6b 0a 69 6d 70 6f 73 65 |itive. T|k.impose|
|00004d60| 73 2c 20 69 6e 20 61 20 | 63 65 72 74 61 69 6e 20 |s, in a |certain |
|00004d70| 65 78 74 65 6e 74 2c 20 | 74 6f 20 74 68 65 20 75 |extent, |to the u|
|00004d80| 6e 64 65 72 6c 79 69 6e | 67 20 69 6e 74 65 72 70 |nderlyin|g interp|
|00004d90| 72 65 74 61 74 69 76 65 | 20 6c 61 6e 67 75 61 67 |retative| languag|
|00004da0| 65 20 74 6f 0a 62 65 20 | 63 61 73 65 20 73 65 6e |e to.be |case sen|
|00004db0| 73 69 74 69 76 65 20 73 | 69 6e 63 65 20 63 6f 6d |sitive s|ince com|
|00004dc0| 6d 61 6e 64 20 69 6e 20 | 65 76 65 6e 74 20 68 61 |mand in |event ha|
|00004dd0| 6e 64 6c 65 72 20 73 63 | 72 69 70 74 73 20 74 61 |ndler sc|ripts ta|
|00004de0| 6b 65 20 69 6e 74 6f 20 | 61 63 63 6f 75 6e 74 0a |ke into |account.|
|00004df0| 74 68 65 20 63 61 73 65 | 20 6f 66 20 74 68 65 20 |the case| of the |
|00004e00| 6c 65 74 74 65 72 20 66 | 6f 6c 6c 6f 77 69 6e 67 |letter f|ollowing|
|00004e10| 20 74 68 65 20 5c 25 20 | 73 79 6d 62 6f 6c 2e 20 | the \% |symbol. |
|00004e20| 0a 0a 5c 69 74 65 6d 20 | 20 41 6e 6f 74 68 65 72 |..\item | Another|
|00004e30| 20 70 72 6f 62 6c 65 6d | 20 61 72 69 73 65 73 20 | problem| arises |
|00004e40| 77 69 74 68 20 6c 69 73 | 74 73 20 61 6e 64 20 73 |with lis|ts and s|
|00004e50| 74 72 69 6e 67 73 3a 20 | 54 63 6c 20 64 6f 65 73 |trings: |Tcl does|
|00004e60| 6e 27 74 0a 64 69 73 74 | 69 6e 67 75 69 73 68 20 |n't.dist|inguish |
|00004e70| 74 68 6f 73 65 20 74 77 | 6f 20 74 79 70 65 73 2e |those tw|o types.|
|00004e80| 20 49 6e 20 70 61 72 74 | 69 63 75 6c 61 72 2c 20 | In part|icular, |
|00004e90| 6f 6e 65 20 63 61 6e 20 | 73 65 74 20 61 6e 20 6f |one can |set an o|
|00004ea0| 70 74 69 6f 6e 20 61 73 | 20 61 20 73 74 72 69 6e |ption as| a strin|
|00004eb0| 67 0a 61 6e 64 20 61 73 | 6b 69 6e 67 20 74 6f 20 |g.and as|king to |
|00004ec0| 54 6b 20 74 68 69 73 20 | 6f 70 74 69 6f 6e 20 76 |Tk this |option v|
|00004ed0| 61 6c 75 65 20 77 69 6c | 6c 20 79 69 65 6c 64 20 |alue wil|l yield |
|00004ee0| 61 20 6c 69 73 74 2e 20 | 54 68 69 73 20 69 73 20 |a list. |This is |
|00004ef0| 6e 6f 74 20 61 20 70 72 | 6f 62 6c 65 6d 20 69 6e |not a pr|oblem in|
|00004f00| 0a 54 63 6c 20 73 69 6e | 63 65 20 61 20 6c 69 73 |.Tcl sin|ce a lis|
|00004f10| 74 20 69 73 20 6f 6e 6c | 79 20 61 6e 6f 74 68 65 |t is onl|y anothe|
|00004f20| 72 20 76 69 73 69 6f 6e | 20 6f 66 20 61 20 73 74 |r vision| of a st|
|00004f30| 72 69 6e 67 2e 20 55 6e | 66 6f 72 74 75 6e 61 74 |ring. Un|fortunat|
|00004f40| 65 6c 79 2c 20 74 68 65 | 72 65 20 69 73 20 6e 6f |ely, the|re is no|
|00004f50| 0a 73 75 63 68 20 64 69 | 72 65 63 74 20 65 71 75 |.such di|rect equ|
|00004f60| 69 76 61 6c 65 6e 63 65 | 20 69 6e 20 53 63 68 65 |ivalence| in Sche|
|00004f70| 6d 65 2e 20 49 6d 70 72 | 6f 76 65 6d 65 6e 74 20 |me. Impr|ovement |
|00004f80| 6f 66 20 74 68 69 73 20 | 70 6f 69 6e 74 20 77 6f |of this |point wo|
|00004f90| 75 6c 64 20 70 72 6f 62 | 61 62 6c 79 0a 72 65 71 |uld prob|ably.req|
|00004fa0| 75 69 72 65 20 61 20 6d | 6f 64 69 66 69 63 61 74 |uire a m|odificat|
|00004fb0| 69 6f 6e 20 6f 66 20 74 | 68 65 20 54 6b 20 6c 69 |ion of t|he Tk li|
|00004fc0| 62 72 61 72 79 2e 0a 0a | 0a 5c 69 74 65 6d 20 4f |brary...|.\item O|
|00004fd0| 6e 65 20 6f 66 20 74 68 | 65 20 6d 61 6a 6f 72 20 |ne of th|e major |
|00004fe0| 61 73 73 65 74 73 20 6f | 66 20 74 68 65 20 54 6b |assets o|f the Tk|
|00004ff0| 20 6c 69 62 72 61 72 79 | 20 69 73 20 74 68 65 20 | library| is the |
|00005000| 7b 5c 74 74 20 73 65 6e | 64 7d 20 63 6f 6d 6d 61 |{\tt sen|d} comma|
|00005010| 6e 64 2e 0a 57 69 74 68 | 20 74 68 69 73 20 63 6f |nd..With| this co|
|00005020| 6d 6d 61 6e 64 2c 20 61 | 20 54 6b 20 61 70 70 6c |mmand, a| Tk appl|
|00005030| 69 63 61 74 69 6f 6e 20 | 63 61 6e 20 61 73 6b 20 |ication |can ask |
|00005040| 74 6f 20 61 6e 6f 74 68 | 65 72 20 72 75 6e 6e 69 |to anoth|er runni|
|00005050| 6e 67 20 54 6b 20 69 6e | 74 65 72 70 72 65 74 65 |ng Tk in|terprete|
|00005060| 72 20 74 6f 0a 65 76 61 | 6c 75 61 74 65 20 61 6e |r to.eva|luate an|
|00005070| 20 65 78 70 72 65 73 73 | 69 6f 6e 2e 20 53 69 6e | express|ion. Sin|
|00005080| 63 65 20 54 6b 20 6c 69 | 62 72 61 72 79 20 69 73 |ce Tk li|brary is|
|00005090| 20 6e 6f 74 20 6d 6f 64 | 69 66 69 65 64 2c 20 5c | not mod|ified, \|
|000050a0| 73 74 6b 20 69 6e 74 65 | 72 70 72 65 74 65 72 73 |stk inte|rpreters|
|000050b0| 0a 63 61 6e 6e 6f 74 20 | 62 65 20 64 69 73 74 69 |.cannot |be disti|
|000050c0| 6e 67 75 69 73 68 65 64 | 20 66 72 6f 6d 20 54 63 |nguished| from Tc|
|000050d0| 6c 20 6f 6e 65 73 2e 20 | 4d 6f 73 74 20 6f 66 20 |l ones. |Most of |
|000050e0| 74 68 65 20 74 69 6d 65 | 2c 20 74 68 69 73 20 69 |the time|, this i|
|000050f0| 73 20 63 6f 6e 66 75 73 | 69 6e 67 20 61 6e 64 0a |s confus|ing and.|
|00005100| 65 72 72 6f 72 20 70 72 | 6f 6e 65 20 62 65 63 61 |error pr|one beca|
|00005110| 75 73 65 20 72 65 71 75 | 65 73 74 73 20 74 6f 20 |use requ|ests to |
|00005120| 61 6e 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 6d |an appli|cation m|
|00005130| 75 73 74 20 74 61 6b 65 | 20 69 6e 74 6f 20 61 63 |ust take| into ac|
|00005140| 63 6f 75 6e 74 20 74 68 | 65 0a 6c 61 6e 67 75 61 |count th|e.langua|
|00005150| 67 65 20 69 74 73 20 75 | 6e 64 65 72 6c 79 69 6e |ge its u|nderlyin|
|00005160| 67 20 69 6e 74 65 72 70 | 72 65 74 65 72 20 75 6e |g interp|reter un|
|00005170| 64 65 72 73 74 61 6e 64 | 73 2e 20 0a 4b 65 65 70 |derstand|s. .Keep|
|00005180| 69 6e 67 20 74 68 65 20 | 63 6f 6d 6d 75 6e 69 63 |ing the |communic|
|00005190| 61 74 69 6f 6e 20 70 6f | 73 73 69 62 69 6c 69 74 |ation po|ssibilit|
|000051a0| 79 20 62 65 74 77 65 65 | 6e 20 5c 73 74 6b 20 61 |y betwee|n \stk a|
|000051b0| 6e 20 54 63 6c 20 61 70 | 70 6c 69 63 61 74 69 6f |n Tcl ap|plicatio|
|000051c0| 6e 73 20 73 65 65 6d 73 | 0a 74 6f 20 62 65 20 73 |ns seems|.to be s|
|000051d0| 75 69 74 61 62 6c 65 2c | 20 62 75 74 20 69 74 20 |uitable,| but it |
|000051e0| 77 6f 75 6c 64 20 62 65 | 20 66 69 6e 65 20 74 6f |would be| fine to|
|000051f0| 20 65 73 74 61 62 6c 69 | 73 68 20 61 20 73 74 61 | establi|sh a sta|
|00005200| 6e 64 61 72 64 20 77 61 | 79 20 74 6f 0a 64 65 74 |ndard wa|y to.det|
|00005210| 65 72 6d 69 6e 65 20 77 | 68 61 74 20 6b 69 6e 64 |ermine w|hat kind|
|00005220| 20 6f 66 20 69 6e 74 65 | 72 70 72 65 74 65 72 20 | of inte|rpreter |
|00005230| 69 73 20 72 75 6e 6e 69 | 6e 67 20 69 6e 20 61 20 |is runni|ng in a |
|00005240| 70 61 72 74 69 63 75 6c | 61 72 20 61 70 70 6c 69 |particul|ar appli|
|00005250| 63 61 74 69 6f 6e 2e 0a | 5c 65 6e 64 20 7b 69 74 |cation..|\end {it|
|00005260| 65 6d 69 7a 65 7d 0a 0a | 0a 5c 62 69 62 6c 69 6f |emize}..|.\biblio|
|00005270| 67 72 61 70 68 79 7b 62 | 69 62 6c 69 6f 67 72 61 |graphy{b|ibliogra|
|00005280| 70 68 79 7d 0a 0a 5c 65 | 6e 64 7b 64 6f 63 75 6d |phy}..\e|nd{docum|
|00005290| 65 6e 74 7d | |ent} | |
+--------+-------------------------+-------------------------+--------+--------+