home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / NEXTSTEP / Languages / python / PyObjC-0.47-MIHS / pyobjc-0.47-src / Doc / libPyObjC.tex / node4_ct.html < prev    next >
LaTeX Document  |  1996-10-23  |  4.9 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


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

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
90% dexvert Hypertext Markup Language File (text/html) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file HTML document text default (weak)
99% file LaTeX document text default
98% file exported SGML document text default
97% file exported SGML document, ASCII text default
80% TrID HyperText Markup Language with DOCTYPE default
19% TrID HyperText Markup Language default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% gt2 HTML (Hyper Text Markup Language) Datei default
100% detectItEasy Format: plain text[LF] default (weak)
100% xdgMime text/html default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 3c 21 44 4f 43 54 59 50 | 45 20 48 54 4d 4c 20 50 |<!DOCTYP|E HTML P|
|00000010| 55 42 4c 49 43 20 22 2d | 2f 2f 57 33 43 2f 2f 44 |UBLIC "-|//W3C//D|
|00000020| 54 44 20 48 54 4d 4c 20 | 33 2e 32 20 46 69 6e 61 |TD HTML |3.2 Fina|
|00000030| 6c 2f 2f 65 6e 22 3e 0a | 0a 3c 21 2d 2d 43 6f 6e |l//en">.|.<!--Con|
|00000040| 76 65 72 74 65 64 20 77 | 69 74 68 20 4c 61 54 65 |verted w|ith LaTe|
|00000050| 58 32 48 54 4d 4c 20 32 | 30 32 32 20 28 52 65 6c |X2HTML 2|022 (Rel|
|00000060| 65 61 73 65 64 20 4a 61 | 6e 75 61 72 79 20 31 2c |eased Ja|nuary 1,|
|00000070| 20 32 30 32 32 29 20 2d | 2d 3e 0a 3c 48 54 4d 4c | 2022) -|->.<HTML|
|00000080| 20 6c 61 6e 67 3d 22 65 | 6e 22 3e 0a 3c 48 45 41 | lang="e|n">.<HEA|
|00000090| 44 3e 0a 3c 54 49 54 4c | 45 3e 43 6f 6e 74 65 6e |D>.<TITL|E>Conten|
|000000a0| 74 73 20 6f 66 20 4f 62 | 6a 43 4f 62 6a 65 63 74 |ts of Ob|jCObject|
|000000b0| 20 6f 62 6a 65 63 74 73 | 3c 2f 54 49 54 4c 45 3e | objects|</TITLE>|
|000000c0| 0a 0a 3c 4d 45 54 41 20 | 48 54 54 50 2d 45 51 55 |..<META |HTTP-EQU|
|000000d0| 49 56 3d 22 43 6f 6e 74 | 65 6e 74 2d 54 79 70 65 |IV="Cont|ent-Type|
|000000e0| 22 20 43 4f 4e 54 45 4e | 54 3d 22 74 65 78 74 2f |" CONTEN|T="text/|
|000000f0| 68 74 6d 6c 3b 20 63 68 | 61 72 73 65 74 3d 75 74 |html; ch|arset=ut|
|00000100| 66 2d 38 22 3e 0a 3c 4d | 45 54 41 20 4e 41 4d 45 |f-8">.<M|ETA NAME|
|00000110| 3d 22 76 69 65 77 70 6f | 72 74 22 20 43 4f 4e 54 |="viewpo|rt" CONT|
|00000120| 45 4e 54 3d 22 77 69 64 | 74 68 3d 64 65 76 69 63 |ENT="wid|th=devic|
|00000130| 65 2d 77 69 64 74 68 2c | 20 69 6e 69 74 69 61 6c |e-width,| initial|
|00000140| 2d 73 63 61 6c 65 3d 31 | 2e 30 22 3e 0a 3c 4d 45 |-scale=1|.0">.<ME|
|00000150| 54 41 20 4e 41 4d 45 3d | 22 47 65 6e 65 72 61 74 |TA NAME=|"Generat|
|00000160| 6f 72 22 20 43 4f 4e 54 | 45 4e 54 3d 22 4c 61 54 |or" CONT|ENT="LaT|
|00000170| 65 58 32 48 54 4d 4c 20 | 76 32 30 32 32 22 3e 0a |eX2HTML |v2022">.|
|00000180| 0a 3c 4c 49 4e 4b 20 52 | 45 4c 3d 22 53 54 59 4c |.<LINK R|EL="STYL|
|00000190| 45 53 48 45 45 54 22 20 | 48 52 45 46 3d 22 6c 69 |ESHEET" |HREF="li|
|000001a0| 62 50 79 4f 62 6a 43 2e | 63 73 73 22 3e 0a 0a 3c |bPyObjC.|css">..<|
|000001b0| 4c 49 4e 4b 20 52 45 4c | 3d 22 6e 65 78 74 22 20 |LINK REL|="next" |
|000001c0| 48 52 45 46 3d 22 6e 6f | 64 65 35 5f 6d 6e 2e 68 |HREF="no|de5_mn.h|
|000001d0| 74 6d 6c 22 3e 0a 3c 4c | 49 4e 4b 20 52 45 4c 3d |tml">.<L|INK REL=|
|000001e0| 22 70 72 65 76 69 6f 75 | 73 22 20 48 52 45 46 3d |"previou|s" HREF=|
|000001f0| 22 6e 6f 64 65 33 5f 6d | 6e 2e 68 74 6d 6c 22 3e |"node3_m|n.html">|
|00000200| 0a 3c 4c 49 4e 4b 20 52 | 45 4c 3d 22 75 70 22 20 |.<LINK R|EL="up" |
|00000210| 48 52 45 46 3d 22 6e 6f | 64 65 32 5f 6d 6e 2e 68 |HREF="no|de2_mn.h|
|00000220| 74 6d 6c 22 3e 0a 3c 4c | 49 4e 4b 20 52 45 4c 3d |tml">.<L|INK REL=|
|00000230| 22 6e 65 78 74 22 20 48 | 52 45 46 3d 22 6e 6f 64 |"next" H|REF="nod|
|00000240| 65 35 5f 6d 6e 2e 68 74 | 6d 6c 22 3e 0a 3c 2f 48 |e5_mn.ht|ml">.</H|
|00000250| 45 41 44 3e 0a 20 0a 3c | 42 4f 44 59 20 62 67 63 |EAD>. .<|BODY bgc|
|00000260| 6f 6c 6f 72 3d 22 23 66 | 66 66 66 66 66 22 20 74 |olor="#f|fffff" t|
|00000270| 65 78 74 3d 22 23 30 30 | 30 30 30 30 22 20 6c 69 |ext="#00|0000" li|
|00000280| 6e 6b 3d 22 23 39 39 34 | 34 45 45 22 20 76 6c 69 |nk="#994|4EE" vli|
|00000290| 6e 6b 3d 22 23 30 30 30 | 30 66 66 22 20 61 6c 69 |nk="#000|0ff" ali|
|000002a0| 6e 6b 3d 22 23 30 30 66 | 66 30 30 22 3e 0a 0a 3c |nk="#00f|f00">..<|
|000002b0| 48 32 3e 3c 41 20 49 44 | 3d 22 53 45 43 54 49 4f |H2><A ID|="SECTIO|
|000002c0| 4e 30 30 31 31 32 30 30 | 30 30 30 30 30 30 30 30 |N0011200|00000000|
|000002d0| 30 30 30 30 30 22 3e 0a | 4f 62 6a 43 4f 62 6a 65 |00000">.|ObjCObje|
|000002e0| 63 74 20 6f 62 6a 65 63 | 74 73 3c 2f 41 3e 0a 3c |ct objec|ts</A>.<|
|000002f0| 2f 48 32 3e 0a 0a 3c 50 | 3e 0a 46 72 6f 6d 20 74 |/H2>..<P|>.From t|
|00000300| 68 65 20 50 79 74 68 6f | 6e 20 70 6f 69 6e 74 20 |he Pytho|n point |
|00000310| 6f 66 20 76 69 65 77 2c | 20 79 6f 75 20 61 63 63 |of view,| you acc|
|00000320| 65 73 73 20 4f 62 6a 65 | 63 74 69 76 65 2d 43 20 |ess Obje|ctive-C |
|00000330| 6f 62 6a 65 63 74 73 20 | 28 62 6f 74 68 0a 63 6c |objects |(both.cl|
|00000340| 61 73 73 65 73 20 61 6e | 64 20 69 6e 73 74 61 6e |asses an|d instan|
|00000350| 63 65 73 29 20 75 73 69 | 6e 67 20 61 20 50 79 74 |ces) usi|ng a Pyt|
|00000360| 68 6f 6e 20 77 72 61 70 | 70 65 72 20 61 72 6f 75 |hon wrap|per arou|
|00000370| 6e 64 20 74 68 65 6d 2c | 0a 4f 62 6a 43 4f 62 6a |nd them,|.ObjCObj|
|00000380| 65 63 74 2e 20 49 74 20 | 69 73 20 72 65 73 70 6f |ect. It |is respo|
|00000390| 6e 73 69 62 6c 65 20 6f | 66 20 66 6f 72 77 61 72 |nsible o|f forwar|
|000003a0| 64 69 6e 67 20 61 6e 79 | 20 75 6e 6b 6e 6f 77 6e |ding any| unknown|
|000003b0| 20 6d 65 74 68 6f 64 20 | 79 6f 75 0a 65 78 65 63 | method |you.exec|
|000003c0| 75 74 65 20 6f 6e 20 69 | 74 20 74 6f 20 74 68 65 |ute on i|t to the|
|000003d0| 20 4f 62 6a 65 63 74 69 | 76 65 2d 43 20 6f 62 6a | Objecti|ve-C obj|
|000003e0| 65 63 74 20 69 74 20 69 | 73 20 63 61 72 72 79 69 |ect it i|s carryi|
|000003f0| 6e 67 2e 0a 0a 3c 50 3e | 0a 4f 62 6a 43 4f 62 6a |ng...<P>|.ObjCObj|
|00000400| 65 63 74 20 6f 62 6a 65 | 63 74 73 20 68 61 76 65 |ect obje|cts have|
|00000410| 20 74 68 65 20 66 6f 6c | 6c 6f 77 69 6e 67 20 6d | the fol|lowing m|
|00000420| 65 74 68 6f 64 73 2e 0a | 0a 3c 50 3e 0a 3c 42 52 |ethods..|.<P>.<BR|
|00000430| 3e 0a 3c 49 4d 47 0a 20 | 20 53 54 59 4c 45 3d 22 |>.<IMG. | STYLE="|
|00000440| 68 65 69 67 68 74 3a 20 | 31 2e 36 38 65 78 3b 20 |height: |1.68ex; |
|00000450| 76 65 72 74 69 63 61 6c | 2d 61 6c 69 67 6e 3a 20 |vertical|-align: |
|00000460| 31 37 37 2e 31 37 65 78 | 3b 20 22 20 53 52 43 3d |177.17ex|; " SRC=|
|00000470| 22 69 6d 67 31 35 2e 70 | 6e 67 22 0a 20 41 4c 54 |"img15.p|ng". ALT|
|00000480| 3d 22 5c 62 65 67 69 6e | 7b 66 75 6e 63 64 65 73 |="\begin|{funcdes|
|00000490| 63 7d 7b 69 73 43 6c 61 | 73 73 7d 7b 7d 0a 52 65 |c}{isCla|ss}{}.Re|
|000004a0| 74 75 72 6e 20 5c 76 61 | 72 7b 54 72 75 65 7d 20 |turn \va|r{True} |
|000004b0| 69 66 20 74 68 65 20 65 | 6e 63 6c 6f 73 65 64 20 |if the e|nclosed |
|000004c0| 4f 62 6a 65 63 74 69 76 | 65 2d 43 20 6f 62 6a 65 |Objectiv|e-C obje|
|000004d0| 63 74 20 69 73 20 61 63 | 74 75 61 6c 6c 79 20 61 |ct is ac|tually a|
|000004e0| 0a 63 6c 61 73 73 2c 20 | 5c 76 61 72 7b 46 61 6c |.class, |\var{Fal|
|000004f0| 73 65 7d 20 6f 74 68 65 | 72 77 69 73 65 2e 0a 5c |se} othe|rwise..\|
|00000500| 65 6e 64 7b 66 75 6e 63 | 64 65 73 63 7d 22 3e 0a |end{func|desc}">.|
|00000510| 3c 42 52 3e 0a 0a 3c 50 | 3e 0a 3c 42 52 3e 0a 3c |<BR>..<P|>.<BR>.<|
|00000520| 49 4d 47 0a 20 20 53 54 | 59 4c 45 3d 22 68 65 69 |IMG. ST|YLE="hei|
|00000530| 67 68 74 3a 20 32 2e 31 | 37 65 78 3b 20 76 65 72 |ght: 2.1|7ex; ver|
|00000540| 74 69 63 61 6c 2d 61 6c | 69 67 6e 3a 20 31 37 36 |tical-al|ign: 176|
|00000550| 2e 36 38 65 78 3b 20 22 | 20 53 52 43 3d 22 69 6d |.68ex; "| SRC="im|
|00000560| 67 31 36 2e 70 6e 67 22 | 0a 20 41 4c 54 3d 22 5c |g16.png"|. ALT="\|
|00000570| 62 65 67 69 6e 7b 66 75 | 6e 63 64 65 73 63 7d 7b |begin{fu|ncdesc}{|
|00000580| 69 73 49 6e 73 74 61 6e | 63 65 7d 7b 7d 0a 52 65 |isInstan|ce}{}.Re|
|00000590| 74 75 72 6e 20 5c 76 61 | 72 7b 54 72 75 65 7d 20 |turn \va|r{True} |
|000005a0| 69 66 20 74 68 65 20 65 | 6e 63 6c 6f 73 65 64 20 |if the e|nclosed |
|000005b0| 4f 62 6a 65 63 74 69 76 | 65 2d 43 20 6f 62 6a 65 |Objectiv|e-C obje|
|000005c0| 63 74 20 69 73 20 61 63 | 74 75 61 6c 6c 79 20 61 |ct is ac|tually a|
|000005d0| 6e 0a 69 6e 73 74 61 6e | 63 65 2c 20 5c 76 61 72 |n.instan|ce, \var|
|000005e0| 7b 46 61 6c 73 65 7d 20 | 6f 74 68 65 72 77 69 73 |{False} |otherwis|
|000005f0| 65 2e 0a 5c 65 6e 64 7b | 66 75 6e 63 64 65 73 63 |e..\end{|funcdesc|
|00000600| 7d 22 3e 0a 3c 42 52 3e | 0a 0a 3c 50 3e 0a 3c 42 |}">.<BR>|..<P>.<B|
|00000610| 52 3e 0a 3c 49 4d 47 0a | 20 20 53 54 59 4c 45 3d |R>.<IMG.| STYLE=|
|00000620| 22 68 65 69 67 68 74 3a | 20 32 2e 31 37 65 78 3b |"height:| 2.17ex;|
|00000630| 20 76 65 72 74 69 63 61 | 6c 2d 61 6c 69 67 6e 3a | vertica|l-align:|
|00000640| 20 31 37 36 2e 35 35 65 | 78 3b 20 22 20 53 52 43 | 176.55e|x; " SRC|
|00000650| 3d 22 69 6d 67 31 37 2e | 70 6e 67 22 0a 20 41 4c |="img17.|png". AL|
|00000660| 54 3d 22 5c 62 65 67 69 | 6e 7b 66 75 6e 63 64 65 |T="\begi|n{funcde|
|00000670| 73 63 7d 7b 43 6c 61 73 | 73 7d 7b 7d 0a 53 69 6e |sc}{Clas|s}{}.Sin|
|00000680| 63 65 20 74 68 65 20 77 | 6f 72 64 20 5c 6c 71 5c |ce the w|ord \lq\|
|00000690| 6c 71 20 63 6c 61 73 73 | 27 27 20 69 73 20 61 20 |lq class|'' is a |
|000006a0| 72 65 73 65 72 76 65 64 | 20 6b 65 79 77 6f 72 64 |reserved| keyword|
|000006b0| 20 69 6e 20 50 79 74 68 | 2e 2e 2e 0a 2e 2e 2e 72 | in Pyth|.......r|
|000006c0| 6e 73 20 74 68 65 20 65 | 71 75 69 76 61 6c 65 6e |ns the e|quivalen|
|000006d0| 74 20 6f 66 20 74 68 65 | 0a 4f 62 6a 65 63 74 69 |t of the|.Objecti|
|000006e0| 76 65 2d 43 20 65 78 70 | 72 65 73 73 69 6f 6e 20 |ve-C exp|ression |
|000006f0| 5c 6c 71 5c 6c 71 20 5b | 6f 62 6a 20 63 6c 61 73 |\lq\lq [|obj clas|
|00000700| 73 5d 27 27 2e 0a 5c 65 | 6e 64 7b 66 75 6e 63 64 |s]''..\e|nd{funcd|
|00000710| 65 73 63 7d 22 3e 0a 3c | 42 52 3e 0a 0a 3c 50 3e |esc}">.<|BR>..<P>|
|00000720| 0a 54 6f 20 73 65 6e 64 | 20 61 20 6d 65 73 73 61 |.To send| a messa|
|00000730| 67 65 20 74 6f 20 61 6e | 20 4f 62 6a 65 63 74 69 |ge to an| Objecti|
|00000740| 76 65 2d 43 20 6f 62 6a | 65 63 74 20 79 6f 75 20 |ve-C obj|ect you |
|00000750| 75 73 65 20 74 68 65 20 | 73 61 6d 65 20 73 79 6e |use the |same syn|
|00000760| 74 61 78 20 61 73 0a 66 | 6f 72 20 61 6e 79 20 6f |tax as.f|or any o|
|00000770| 74 68 65 72 20 50 79 74 | 68 6f 6e 20 6f 62 6a 65 |ther Pyt|hon obje|
|00000780| 63 74 3a 0a 0a 3c 50 3e | 0a 3c 50 52 45 3e 0a 26 |ct:..<P>|.<PRE>.&|
|00000790| 67 74 3b 26 67 74 3b 26 | 67 74 3b 20 69 6d 70 6f |gt;&gt;&|gt; impo|
|000007a0| 72 74 20 4f 62 6a 43 0a | 26 67 74 3b 26 67 74 3b |rt ObjC.|&gt;&gt;|
|000007b0| 26 67 74 3b 20 4c 69 73 | 74 20 3d 20 4f 62 6a 43 |&gt; Lis|t = ObjC|
|000007c0| 2e 72 75 6e 74 69 6d 65 | 2e 4c 69 73 74 0a 26 67 |.runtime|.List.&g|
|000007d0| 74 3b 26 67 74 3b 26 67 | 74 3b 20 6c 69 73 74 20 |t;&gt;&g|t; list |
|000007e0| 3d 20 4c 69 73 74 28 29 | 0a 26 67 74 3b 26 67 74 |= List()|.&gt;&gt|
|000007f0| 3b 26 67 74 3b 20 4f 62 | 6a 65 63 74 20 3d 20 4f |;&gt; Ob|ject = O|
|00000800| 62 6a 43 2e 72 75 6e 74 | 69 6d 65 2e 4f 62 6a 65 |bjC.runt|ime.Obje|
|00000810| 63 74 0a 26 67 74 3b 26 | 67 74 3b 26 67 74 3b 20 |ct.&gt;&|gt;&gt; |
|00000820| 69 6e 73 74 61 6e 63 65 | 20 3d 20 4f 62 6a 65 63 |instance| = Objec|
|00000830| 74 28 29 0a 26 67 74 3b | 26 67 74 3b 26 67 74 3b |t().&gt;|&gt;&gt;|
|00000840| 20 6c 69 73 74 2e 61 64 | 64 4f 62 6a 65 63 74 5f | list.ad|dObject_|
|00000850| 5f 20 28 69 6e 73 74 61 | 6e 63 65 29 0a 3c 2f 50 |_ (insta|nce).</P|
|00000860| 52 45 3e 0a 0a 3c 50 3e | 0a 44 75 65 20 74 6f 20 |RE>..<P>|.Due to |
|00000870| 74 68 65 20 64 69 66 66 | 65 72 65 6e 74 20 63 61 |the diff|erent ca|
|00000880| 6c 6c 69 6e 67 20 73 79 | 6e 74 61 78 20 74 68 6f |lling sy|ntax tho|
|00000890| 75 67 68 20 74 68 65 20 | 4f 62 6a 65 63 74 69 76 |ugh the |Objectiv|
|000008a0| 65 2d 43 20 73 65 6c 65 | 63 74 6f 72 73 0a 6e 61 |e-C sele|ctors.na|
|000008b0| 6d 65 20 63 68 61 6e 67 | 65 20 73 6c 69 67 68 74 |me chang|e slight|
|000008c0| 6c 79 3a 20 74 68 65 20 | 65 78 70 72 65 73 73 69 |ly: the |expressi|
|000008d0| 6f 6e 20 60 60 5b 6f 62 | 6a 20 73 6f 6d 65 4d 65 |on ``[ob|j someMe|
|000008e0| 74 68 6f 64 3a 61 72 67 | 41 0a 77 69 74 68 3a 61 |thod:arg|A.with:a|
|000008f0| 72 67 42 5d 27 27 20 62 | 65 63 6f 6d 65 73 20 60 |rgB]'' b|ecomes `|
|00000900| 60 6f 62 6a 2e 73 6f 6d | 65 4d 65 74 68 6f 64 5f |`obj.som|eMethod_|
|00000910| 5f 77 69 74 68 5f 5f 20 | 28 61 72 67 41 2c 20 61 |_with__ |(argA, a|
|00000920| 72 67 42 29 27 27 20 6f | 6e 63 65 0a 63 6f 64 65 |rgB)'' o|nce.code|
|00000930| 64 20 69 6e 20 50 79 74 | 68 6f 6e 2e 20 54 68 65 |d in Pyt|hon. The|
|00000940| 20 72 75 6c 65 20 74 6f | 20 66 6f 6c 6c 6f 77 20 | rule to| follow |
|00000950| 69 73 20 76 65 72 79 20 | 73 69 6d 70 6c 65 3a 20 |is very |simple: |
|00000960| 74 61 6b 65 20 74 68 65 | 20 3c 45 4d 3e 63 6f 6e |take the| <EM>con|
|00000970| 63 69 73 65 3c 2f 45 4d | 3e 20 6e 6f 74 61 74 69 |cise</EM|> notati|
|00000980| 6f 6e 20 6f 66 20 74 68 | 65 20 73 65 6c 65 63 74 |on of th|e select|
|00000990| 6f 72 20 28 74 68 65 20 | 65 78 61 6d 70 6c 65 20 |or (the |example |
|000009a0| 61 62 6f 76 65 20 67 69 | 76 65 73 0a 60 60 73 6f |above gi|ves.``so|
|000009b0| 6d 65 4d 65 74 68 6f 64 | 3a 77 69 74 68 3a 27 27 |meMethod|:with:''|
|000009c0| 29 20 61 6e 64 20 72 65 | 70 6c 61 63 65 20 65 76 |) and re|place ev|
|000009d0| 65 72 79 20 63 6f 6c 6f | 6e 20 28 27 3a 27 29 20 |ery colo|n (':') |
|000009e0| 63 68 61 72 61 63 74 65 | 72 20 77 69 74 68 20 61 |characte|r with a|
|000009f0| 0a 64 6f 75 62 6c 65 20 | 75 6e 64 65 72 73 63 6f |.double |undersco|
|00000a00| 72 65 20 28 27 5f 5f 27 | 29 2c 20 74 68 65 6e 20 |re ('__'|), then |
|00000a10| 66 65 65 64 20 74 68 65 | 20 61 72 67 75 6d 65 6e |feed the| argumen|
|00000a20| 74 73 20 61 73 20 75 73 | 75 61 6c 2e 20 41 73 20 |ts as us|ual. As |
|00000a30| 79 6f 75 20 6d 61 79 0a | 6e 6f 74 69 63 65 2c 20 |you may.|notice, |
|00000a40| 74 68 65 20 6e 61 6d 65 | 20 6f 66 20 73 65 6c 65 |the name| of sele|
|00000a50| 63 74 6f 72 73 20 77 69 | 74 68 6f 75 74 20 61 72 |ctors wi|thout ar|
|00000a60| 67 75 6d 65 6e 74 73 20 | 64 6f 65 73 20 6e 6f 74 |guments |does not|
|00000a70| 20 63 68 61 6e 67 65 20 | 61 74 20 61 6c 6c 2e 0a | change |at all..|
|00000a80| 0a 3c 50 3e 0a 41 6e 20 | 61 6c 74 65 72 6e 61 74 |.<P>.An |alternat|
|00000a90| 69 76 65 20 74 72 61 6e | 73 6c 61 74 69 6f 6e 20 |ive tran|slation |
|00000aa0| 73 63 68 65 6d 65 20 77 | 61 73 20 69 6e 74 72 6f |scheme w|as intro|
|00000ab0| 64 75 63 65 64 20 77 69 | 74 68 20 76 65 72 73 69 |duced wi|th versi|
|00000ac0| 6f 6e 20 30 2e 34 35 20 | 6f 66 20 74 68 65 0a 6d |on 0.45 |of the.m|
|00000ad0| 6f 64 75 6c 65 3a 20 66 | 69 72 73 74 20 72 65 70 |odule: f|irst rep|
|00000ae0| 6c 61 63 65 20 65 76 65 | 72 79 20 75 6e 64 65 72 |lace eve|ry under|
|00000af0| 73 63 6f 72 65 20 69 6e | 20 74 68 65 20 6e 61 6d |score in| the nam|
|00000b00| 65 20 77 69 74 68 20 61 | 20 74 72 69 70 6c 65 20 |e with a| triple |
|00000b10| 6f 6e 65 0a 28 27 5f 5f | 5f 27 29 2c 20 74 68 65 |one.('__|_'), the|
|00000b20| 6e 20 72 65 70 6c 61 63 | 65 20 65 76 65 72 79 20 |n replac|e every |
|00000b30| 63 6f 6c 6f 6e 20 77 69 | 74 68 20 61 20 73 69 6e |colon wi|th a sin|
|00000b40| 67 6c 65 20 75 6e 64 65 | 72 73 63 6f 72 65 2e 20 |gle unde|rscore. |
|00000b50| 53 69 6e 63 65 0a 75 6e | 64 65 72 73 63 6f 72 65 |Since.un|derscore|
|00000b60| 73 20 61 72 65 20 6e 6f | 74 20 63 6f 6d 6d 6f 6e |s are no|t common|
|00000b70| 20 69 6e 20 4f 62 6a 65 | 63 74 69 76 65 2d 43 20 | in Obje|ctive-C |
|00000b80| 6d 65 74 68 6f 64 20 6e | 61 6d 65 73 2c 20 74 68 |method n|ames, th|
|00000b90| 69 73 20 67 69 76 65 73 | 0a 73 68 6f 72 74 65 72 |is gives|.shorter|
|00000ba0| 20 6e 61 6d 65 73 2e 20 | 0a 0a 3c 50 3e 0a 3c 49 | names. |..<P>.<I|
|00000bb0| 3e 53 69 6e 63 65 20 61 | 6c 6c 6f 77 69 6e 67 20 |>Since a|llowing |
|00000bc0| 74 68 69 73 20 64 6f 75 | 62 6c 65 20 73 79 6e 74 |this dou|ble synt|
|00000bd0| 61 78 20 69 6e 74 72 6f | 64 75 63 65 73 20 61 20 |ax intro|duces a |
|00000be0| 6c 69 74 74 6c 65 20 73 | 70 65 65 64 0a 70 65 6e |little s|peed.pen|
|00000bf0| 61 6c 69 74 79 2c 20 49 | 20 70 6c 61 6e 20 74 6f |ality, I| plan to|
|00000c00| 20 72 65 6d 6f 76 65 20 | 6f 6e 65 20 6f 66 20 74 | remove |one of t|
|00000c10| 68 65 20 61 6c 74 65 72 | 6e 61 74 69 76 65 73 20 |he alter|natives |
|00000c20| 69 6e 20 74 68 65 20 66 | 69 6e 61 6c 20 31 2e 30 |in the f|inal 1.0|
|00000c30| 0a 72 65 6c 65 61 73 65 | 2e 3c 2f 49 3e 20 0a 0a |.release|.</I> ..|
|00000c40| 3c 50 3e 0a 54 68 65 20 | 6e 6f 74 61 74 69 6f 6e |<P>.The |notation|
|00000c50| 20 60 60 6c 69 73 74 2e | 61 64 64 4f 62 6a 65 63 | ``list.|addObjec|
|00000c60| 74 5f 5f 27 27 20 64 6f | 65 73 20 61 63 74 75 61 |t__'' do|es actua|
|00000c70| 6c 6c 79 20 72 65 74 75 | 72 6e 20 61 0a 4f 62 6a |lly retu|rn a.Obj|
|00000c80| 43 4d 65 74 68 6f 64 20 | 69 6e 73 74 61 6e 63 65 |CMethod |instance|
|00000c90| 2c 20 64 65 73 63 72 69 | 62 65 64 20 62 65 6c 6f |, descri|bed belo|
|00000ca0| 77 2c 20 74 68 61 74 20 | 79 6f 75 20 6d 61 79 20 |w, that |you may |
|00000cb0| 63 61 63 68 65 0a 61 73 | 20 61 6e 79 20 6f 74 68 |cache.as| any oth|
|00000cc0| 65 72 20 6d 65 74 68 6f | 64 2e 20 46 6f 72 20 65 |er metho|d. For e|
|00000cd0| 78 61 6d 70 6c 65 3a 0a | 0a 3c 50 3e 0a 3c 50 52 |xample:.|.<P>.<PR|
|00000ce0| 45 3e 0a 26 67 74 3b 26 | 67 74 3b 26 67 74 3b 20 |E>.&gt;&|gt;&gt; |
|00000cf0| 69 6d 70 6f 72 74 20 4f | 62 6a 43 0a 26 67 74 3b |import O|bjC.&gt;|
|00000d00| 26 67 74 3b 26 67 74 3b | 20 4c 69 73 74 20 3d 20 |&gt;&gt;| List = |
|00000d10| 4f 62 6a 43 2e 72 75 6e | 74 69 6d 65 2e 4c 69 73 |ObjC.run|time.Lis|
|00000d20| 74 0a 26 67 74 3b 26 67 | 74 3b 26 67 74 3b 20 6c |t.&gt;&g|t;&gt; l|
|00000d30| 69 73 74 5f 61 6c 6c 6f | 63 20 3d 20 4c 69 73 74 |ist_allo|c = List|
|00000d40| 2e 61 6c 6c 6f 63 0a 26 | 67 74 3b 26 67 74 3b 26 |.alloc.&|gt;&gt;&|
|00000d50| 67 74 3b 20 69 6e 73 74 | 61 6e 63 65 20 3d 20 6c |gt; inst|ance = l|
|00000d60| 69 73 74 5f 61 6c 6c 6f | 63 28 29 2e 69 6e 69 74 |ist_allo|c().init|
|00000d70| 28 29 0a 3c 2f 50 52 45 | 3e 0a 0a 3c 50 3e 0a 57 |().</PRE|>..<P>.W|
|00000d80| 68 65 6e 20 61 6e 20 4f | 62 6a 43 4f 62 6a 65 63 |hen an O|bjCObjec|
|00000d90| 74 20 72 65 70 72 65 73 | 65 6e 74 20 61 20 4f 62 |t repres|ent a Ob|
|00000da0| 6a 65 63 74 69 76 65 2d | 43 20 63 6c 61 73 73 2c |jective-|C class,|
|00000db0| 20 79 6f 75 20 63 61 6e | 20 60 60 63 61 6c 6c 27 | you can| ``call'|
|00000dc0| 27 20 69 74 0a 61 73 20 | 79 6f 75 20 6e 6f 72 6d |' it.as |you norm|
|00000dd0| 61 6c 6c 79 20 64 6f 20 | 77 69 74 68 20 50 79 74 |ally do |with Pyt|
|00000de0| 68 6f 6e 20 63 6c 61 73 | 73 65 73 3a 20 69 74 20 |hon clas|ses: it |
|00000df0| 69 73 20 61 20 73 68 6f | 72 74 63 75 74 20 66 6f |is a sho|rtcut fo|
|00000e00| 72 20 61 20 6c 6f 6e 67 | 65 72 0a 60 60 2e 61 6c |r a long|er.``.al|
|00000e10| 6c 6f 63 28 29 2e 69 6e | 69 74 28 29 27 27 2e 20 |loc().in|it()''. |
|00000e20| 59 6f 75 20 63 61 6e 20 | 70 61 73 73 20 69 6e 69 |You can |pass ini|
|00000e30| 74 69 61 6c 69 7a 61 74 | 69 6f 6e 20 61 72 67 75 |tializat|ion argu|
|00000e40| 6d 65 6e 74 73 20 74 6f | 20 74 68 65 0a 63 61 6c |ments to| the.cal|
|00000e50| 6c 3a 20 69 66 20 74 68 | 65 20 4f 62 6a 65 63 74 |l: if th|e Object|
|00000e60| 69 76 65 2d 43 20 63 6c | 61 73 73 20 69 6e 73 74 |ive-C cl|ass inst|
|00000e70| 61 6e 63 65 20 72 65 73 | 70 6f 6e 64 73 20 74 6f |ance res|ponds to|
|00000e80| 20 61 20 6d 65 74 68 6f | 64 20 63 61 6c 6c 65 64 | a metho|d called|
|00000e90| 0a 60 60 69 6e 69 74 3a | 3a 3a 2e 2e 2e 27 27 20 |.``init:|::...'' |
|00000ea0| 74 68 61 74 20 6d 65 74 | 68 6f 64 20 69 73 20 63 |that met|hod is c|
|00000eb0| 61 6c 6c 65 64 20 66 65 | 65 64 69 6e 67 20 69 74 |alled fe|eding it|
|00000ec0| 20 74 68 65 20 61 72 67 | 75 6d 65 6e 74 73 20 61 | the arg|uments a|
|00000ed0| 73 0a 75 73 75 61 6c 2e | 20 41 6c 74 65 72 6e 61 |s.usual.| Alterna|
|00000ee0| 74 69 76 65 6c 79 2c 20 | 79 6f 75 20 6d 61 79 20 |tively, |you may |
|00000ef0| 73 70 65 63 69 66 79 20 | 74 68 65 20 72 69 67 68 |specify |the righ|
|00000f00| 74 20 73 65 6c 65 63 74 | 6f 72 20 74 6f 20 62 65 |t select|or to be|
|00000f10| 20 75 73 65 64 20 74 6f | 0a 69 6e 69 74 69 61 6c | used to|.initial|
|00000f20| 69 7a 65 20 74 68 65 20 | 6f 62 6a 65 63 74 20 62 |ize the |object b|
|00000f30| 79 20 75 73 69 6e 67 20 | 74 68 65 20 69 6e 69 74 |y using |the init|
|00000f40| 20 6b 65 79 77 6f 72 64 | 20 70 61 72 61 6d 65 74 | keyword| paramet|
|00000f50| 65 72 2c 20 69 6e 0a 74 | 68 69 73 20 77 61 79 3a |er, in.t|his way:|
|00000f60| 0a 0a 3c 50 3e 0a 3c 50 | 52 45 3e 0a 26 67 74 3b |..<P>.<P|RE>.&gt;|
|00000f70| 26 67 74 3b 26 67 74 3b | 20 69 6d 70 6f 72 74 20 |&gt;&gt;| import |
|00000f80| 4f 62 6a 43 0a 26 67 74 | 3b 26 67 74 3b 26 67 74 |ObjC.&gt|;&gt;&gt|
|00000f90| 3b 20 4c 69 73 74 20 3d | 20 4f 62 6a 43 2e 72 75 |; List =| ObjC.ru|
|00000fa0| 6e 74 69 6d 65 2e 4c 69 | 73 74 0a 26 67 74 3b 26 |ntime.Li|st.&gt;&|
|00000fb0| 67 74 3b 26 67 74 3b 20 | 6c 69 73 74 20 3d 20 4c |gt;&gt; |list = L|
|00000fc0| 69 73 74 28 31 30 2c 20 | 69 6e 69 74 3d 27 69 6e |ist(10, |init='in|
|00000fd0| 69 74 43 6f 75 6e 74 3a | 27 29 0a 3c 2f 50 52 45 |itCount:|').</PRE|
|00000fe0| 3e 0a 0a 3c 50 3e 0a 49 | 66 20 74 68 65 20 77 72 |>..<P>.I|f the wr|
|00000ff0| 61 70 70 65 64 20 4f 62 | 6a 65 63 74 69 76 65 2d |apped Ob|jective-|
|00001000| 43 20 6f 62 6a 65 63 74 | 20 69 6d 70 6c 65 6d 65 |C object| impleme|
|00001010| 6e 74 73 20 74 68 65 20 | 6d 65 74 68 6f 64 73 0a |nts the |methods.|
|00001020| 2d 6c 65 6e 67 74 68 20 | 28 6f 72 20 2d 63 6f 75 |-length |(or -cou|
|00001030| 6e 74 29 20 61 6e 64 20 | 2d 6f 62 6a 65 63 74 41 |nt) and |-objectA|
|00001040| 74 3a 20 28 6f 72 0a 2d | 6f 62 6a 65 63 74 41 74 |t: (or.-|objectAt|
|00001050| 49 6e 64 65 78 3a 29 20 | 74 68 61 6e 20 69 74 27 |Index:) |than it'|
|00001060| 73 20 70 6f 73 73 69 62 | 6c 65 20 74 6f 20 74 72 |s possib|le to tr|
|00001070| 65 61 74 20 69 74 20 61 | 73 20 61 6e 79 20 6f 74 |eat it a|s any ot|
|00001080| 68 65 72 0a 73 65 71 75 | 65 6e 63 65 20 6f 62 6a |her.sequ|ence obj|
|00001090| 65 63 74 2c 20 74 68 75 | 73 20 67 69 76 69 6e 67 |ect, thu|s giving|
|000010a0| 3a 0a 0a 3c 50 3e 0a 3c | 50 52 45 3e 0a 26 67 74 |:..<P>.<|PRE>.&gt|
|000010b0| 3b 26 67 74 3b 26 67 74 | 3b 20 6c 69 73 74 20 3d |;&gt;&gt|; list =|
|000010c0| 20 4f 62 6a 43 2e 72 75 | 6e 74 69 6d 65 2e 4c 69 | ObjC.ru|ntime.Li|
|000010d0| 73 74 28 29 0a 26 67 74 | 3b 26 67 74 3b 26 67 74 |st().&gt|;&gt;&gt|
|000010e0| 3b 20 6c 69 73 74 2e 61 | 64 64 4f 62 6a 65 63 74 |; list.a|ddObject|
|000010f0| 5f 5f 20 28 27 73 70 61 | 6d 27 29 0a 26 67 74 3b |__ ('spa|m').&gt;|
|00001100| 26 67 74 3b 26 67 74 3b | 20 6c 69 73 74 2e 61 64 |&gt;&gt;| list.ad|
|00001110| 64 4f 62 6a 65 63 74 5f | 5f 20 28 31 29 0a 26 67 |dObject_|_ (1).&g|
|00001120| 74 3b 26 67 74 3b 26 67 | 74 3b 20 6c 69 73 74 2e |t;&gt;&g|t; list.|
|00001130| 61 64 64 4f 62 6a 65 63 | 74 5f 5f 20 28 27 6c 69 |addObjec|t__ ('li|
|00001140| 74 65 72 27 29 0a 26 67 | 74 3b 26 67 74 3b 26 67 |ter').&g|t;&gt;&g|
|00001150| 74 3b 20 6c 69 73 74 2e | 61 64 64 4f 62 6a 65 63 |t; list.|addObjec|
|00001160| 74 5f 5f 20 28 27 70 6c | 65 61 73 65 29 0a 26 67 |t__ ('pl|ease).&g|
|00001170| 74 3b 26 67 74 3b 26 67 | 74 3b 20 70 72 69 6e 74 |t;&gt;&g|t; print|
|00001180| 20 6c 69 73 74 2e 63 6f | 75 6e 74 28 29 0a 34 0a | list.co|unt().4.|
|00001190| 26 67 74 3b 26 67 74 3b | 26 67 74 3b 20 70 72 69 |&gt;&gt;|&gt; pri|
|000011a0| 6e 74 20 6c 69 73 74 2e | 63 61 70 61 63 69 74 79 |nt list.|capacity|
|000011b0| 28 29 0a 37 0a 26 67 74 | 3b 26 67 74 3b 26 67 74 |().7.&gt|;&gt;&gt|
|000011c0| 3b 20 70 72 69 6e 74 20 | 6c 69 73 74 5b 3a 5d 0a |; print |list[:].|
|000011d0| 5b 27 73 70 61 6d 27 2c | 20 31 2c 20 27 6c 69 74 |['spam',| 1, 'lit|
|000011e0| 65 72 27 2c 20 27 70 6c | 65 61 73 65 27 5d 0a 26 |er', 'pl|ease'].&|
|000011f0| 67 74 3b 26 67 74 3b 26 | 67 74 3b 20 70 72 69 6e |gt;&gt;&|gt; prin|
|00001200| 74 20 6c 69 73 74 2b 6c | 69 73 74 0a 5b 27 73 70 |t list+l|ist.['sp|
|00001210| 61 6d 27 2c 20 31 2c 20 | 27 6c 69 74 65 72 27 2c |am', 1, |'liter',|
|00001220| 20 27 70 6c 65 61 73 65 | 27 2c 20 27 73 70 61 6d | 'please|', 'spam|
|00001230| 27 2c 20 31 2c 20 27 6c | 69 74 65 72 27 2c 20 27 |', 1, 'l|iter', '|
|00001240| 70 6c 65 61 73 65 27 5d | 0a 26 67 74 3b 26 67 74 |please']|.&gt;&gt|
|00001250| 3b 26 67 74 3b 20 70 72 | 69 6e 74 20 6c 69 73 74 |;&gt; pr|int list|
|00001260| 2a 33 0a 5b 27 73 70 61 | 6d 27 2c 20 31 2c 20 27 |*3.['spa|m', 1, '|
|00001270| 6c 69 74 65 72 27 2c 20 | 27 70 6c 65 61 73 65 27 |liter', |'please'|
|00001280| 2c 20 27 73 70 61 6d 27 | 2c 20 31 2c 20 27 6c 69 |, 'spam'|, 1, 'li|
|00001290| 74 65 72 27 2c 20 27 70 | 6c 65 61 73 65 27 2c 0a |ter', 'p|lease',.|
|000012a0| 27 73 70 61 6d 27 2c 20 | 31 2c 20 27 6c 69 74 65 |'spam', |1, 'lite|
|000012b0| 72 27 2c 20 27 70 6c 65 | 61 73 65 27 5d 0a 26 67 |r', 'ple|ase'].&g|
|000012c0| 74 3b 26 67 74 3b 26 67 | 74 3b 20 66 6f 72 20 69 |t;&gt;&g|t; for i|
|000012d0| 20 69 6e 20 6c 69 73 74 | 3a 20 70 72 69 6e 74 20 | in list|: print |
|000012e0| 69 0a 2e 2e 2e 0a 73 70 | 61 6d 0a 31 0a 6c 69 74 |i.....sp|am.1.lit|
|000012f0| 65 72 0a 70 6c 65 61 73 | 65 0a 3c 2f 50 52 45 3e |er.pleas|e.</PRE>|
|00001300| 0a 0a 3c 50 3e 0a 4f 74 | 68 65 72 77 69 73 65 2c |..<P>.Ot|herwise,|
|00001310| 20 69 66 20 69 74 20 69 | 6d 70 6c 65 6d 65 6e 74 | if it i|mplement|
|00001320| 73 20 74 68 65 20 6d 65 | 74 68 6f 64 73 0a 2d 6c |s the me|thods.-l|
|00001330| 65 6e 67 74 68 20 28 6f | 72 20 2d 63 6f 75 6e 74 |ength (o|r -count|
|00001340| 29 20 61 6e 64 20 2d 76 | 61 6c 75 65 46 6f 72 4b |) and -v|alueForK|
|00001350| 65 79 3a 20 28 6f 72 0a | 2d 6f 62 6a 65 63 74 46 |ey: (or.|-objectF|
|00001360| 6f 72 4b 65 79 3a 29 20 | 74 68 61 6e 20 69 74 27 |orKey:) |than it'|
|00001370| 73 20 70 6f 73 73 69 62 | 6c 65 20 74 6f 20 74 72 |s possib|le to tr|
|00001380| 65 61 74 20 69 74 20 61 | 73 20 61 6e 79 20 6f 74 |eat it a|s any ot|
|00001390| 68 65 72 0a 6d 61 70 70 | 69 6e 67 20 6f 62 6a 65 |her.mapp|ing obje|
|000013a0| 63 74 2e 0a 0a 3c 50 3e | 0a 0a 3c 48 52 3e 0a 0a |ct...<P>|..<HR>..|
|000013b0| 3c 2f 42 4f 44 59 3e 0a | 3c 2f 48 54 4d 4c 3e 0a |</BODY>.|</HTML>.|
+--------+-------------------------+-------------------------+--------+--------+