polymorphism: better names for .binaryValue and .booleanValue are .asInteger and...
[supercollider.git] / Help / More-On-Getting-Help.html
blobc3e008021149ecdeb08bc7b6e343716816db1006
1 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2 <html>
3 <head>
4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
5 <meta http-equiv="Content-Style-Type" content="text/css">
6 <title></title>
7 <meta name="Generator" content="Cocoa HTML Writer">
8 <meta name="CocoaVersion" content="949.54">
9 <style type="text/css">
10 p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 18.0px Helvetica}
11 p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; min-height: 14.0px}
12 p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica}
13 p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica}
14 p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #bf0000}
15 p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco}
16 p.p7 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #ad140d}
17 p.p8 {margin: 0.0px 0.0px 0.0px 0.0px; font: 9.0px Monaco; color: #001bb9}
18 p.p9 {margin: 0.0px 0.0px 0.0px 0.0px; font: 14.0px Helvetica; min-height: 17.0px}
19 p.p10 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #001bb9}
20 p.p11 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica; color: #001bb9; min-height: 14.0px}
21 span.s1 {color: #001bb9}
22 span.s2 {color: #0000bf}
23 span.s3 {color: #000000}
24 span.s4 {font: 9.0px Monaco}
25 span.s5 {font: 9.0px Monaco; color: #001bb9}
26 span.s6 {color: #2c7014}
27 span.s7 {text-decoration: underline}
28 span.Apple-tab-span {white-space:pre}
29 </style>
30 </head>
31 <body>
32 <p class="p1"><b>More on Getting Help</b></p>
33 <p class="p2"><br></p>
34 <p class="p3"><span class="Apple-tab-span"> </span><i>Note:</i> This help file uses the key commands for OS X; on other systems, please substitute the <a href="Other Topics/Shortcuts.html"><span class="s1">Shortcuts</span></a> as necessary<span class="Apple-converted-space"> </span></p>
35 <p class="p2"><br></p>
36 <p class="p3">Listed below are a few techniques for tracking down documentation and functionality. <b>Note: </b>If some of the terms used below (e.g. class, method, inheritance, etc.) are unclear to you, you may wish to read the <b>Language</b> helpfiles which are listed in the main help window for detail on some of these concepts. Reading a general tutorial on Object Oriented Programming at some point could also be useful, as could reading a FAQ, etc. about Smalltalk. Smalltalk is the general purpose OOP language upon which the the design of the SuperCollider language is based. Its syntax is different than SC's, but conceptually it has much in common.</p>
37 <p class="p2"><br></p>
38 <p class="p3"><b>NB: </b>Be sure to check out the Further Info section at the bottom of this page.</p>
39 <p class="p2"><br></p>
40 <p class="p4"><b>Basics<span class="Apple-converted-space"> <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span></b></p>
41 <p class="p2"><br></p>
42 <p class="p3">As you've probably already learned selecting any text and pressing Cmd-d will open the corresponding helpfile. Usually helpfiles are either concept related, or document particular classes. In the SC language classes begin with capital letters. Try Cmd-d on the following (double click on the first word; the stuff after the two slashes is a comment):</p>
43 <p class="p2"><br></p>
44 <p class="p5"><span class="s2">Class</span><span class="s3"> </span>// this is a class</p>
45 <p class="p2"><br></p>
46 <p class="p3">A few methods also have helpfiles. Methods begin with lower-case letters, as do many other things in the language.</p>
47 <p class="p2"><br></p>
48 <p class="p5"><span class="s3">play </span>// Cmd-d on this will open a helpfile detailing different implementations of this method</p>
49 <p class="p2"><br></p>
50 <p class="p3">In addition there are a many helpfiles which explain important concepts. Most of these are listed in the main help window (Help.html, which will open if you press Cmd-d with no text selected), or in the overviews listed there. The file called <a href="Tutorials/Tutorial.html"><span class="s1">Tutorial</span></a> is one example.</p>
51 <p class="p2"><br></p>
52 <p class="p3">Much documentation contains hypertext links to other helpfiles. Click the link to open the corresponding helpfile.</p>
53 <p class="p2"><br></p>
54 <p class="p3">Note that many helpful methods print information to the 'post window'. Unless you have explicitly changed it (see the Window menu) this is the window which opened when you launched. Pressing Cmd-\ will bring the current post window to the front.</p>
55 <p class="p2"><br></p>
56 <p class="p4"><b>Tracking Down Information</b></p>
57 <p class="p2"><br></p>
58 <p class="p3">Executing the following</p>
59 <p class="p2"><br></p>
60 <p class="p6"><span class="s1">Help</span>.gui;</p>
61 <p class="p2"><br></p>
62 <p class="p3">will open a "help browser" which lists all helpfiles in thematic categories. (Equivalently, press Shift-Cmd-D)</p>
63 <p class="p2"><br></p>
64 <p class="p3">The helpfile <a href="Other Topics/Undocumented-Classes.html"><span class="s1">Undocumented-Classes</span></a><b> </b>contains a (possibly out of date) list of all classes which have no helpfiles. This can be a good place to start looking for functionality which may already be implemented.</p>
65 <p class="p2"><br></p>
66 <p class="p3">Looking in class definitions (select any class and press Cmd-j to open its class definition file) can help you to figure out what undocumented methods do.</p>
67 <p class="p2"><br></p>
68 <p class="p7"><span class="s1">Array</span><span class="s3"> </span>// Try Cmd-j on this</p>
69 <p class="p2"><br></p>
70 <p class="p3">Since many methods use other classes, you may need to continue your search in other class definitions or helpfiles.</p>
71 <p class="p2"><br></p>
72 <p class="p3">Executing the method dumpInterface on any class will list its class and instance methods and their arguments (if any).</p>
73 <p class="p2"><br></p>
74 <p class="p7"><span class="s1">Array</span><span class="s3">.dumpInterface; </span>// Look at the post window (the one that opened when you started SC)</p>
75 <p class="p2"><br></p>
76 <p class="p3">Note that since the SuperCollider language is object-oriented many classes inherit methods from farther up the class hierarchy. (The many subclasses of Collection are a good example of this. See the <a href="Collections/Collections.html"><span class="s1">Collections</span></a> overview for more detail.) It would be impractical and redundant to document every inherited method that a class responds to, so it is important to be able to track down documentation and method definitions. <span class="Apple-converted-space"> </span></p>
77 <p class="p2"><br></p>
78 <p class="p3">The method dumpFullInterface applied to any Class will list all class and instance methods that a class responds to, sorted by the class in which they are implemented. This will include inherited methods. Methods overidden in a subclass are listed under the subclass.</p>
79 <p class="p2"><br></p>
80 <p class="p6"><span class="s1">Array</span>.dumpFullInterface;</p>
81 <p class="p2"><br></p>
82 <p class="p3">This can be a lot of information, so dumpAllMethods or class.dumpAllMethods will show only instance and class methods respectively.</p>
83 <p class="p2"><br></p>
84 <p class="p7"><span class="s1">Array</span><span class="s3">.class.dumpAllMethods; </span>// Only class methods that this responds to (including inherited ones)</p>
85 <p class="p7"><span class="s1">Array</span><span class="s3">.dumpAllMethods; <span class="Apple-tab-span"> </span><span class="Apple-tab-span"> </span></span>// Only instance methods (including inherited ones)</p>
86 <p class="p2"><br></p>
87 <p class="p3">There is also a graphical Class browser which will show all methods, arguments, subclasses, instance variables and class variables. Using the browser's buttons you can easily navigate to the class' superclass, subclasses, class source, method source, helpfile (if there is one), check references or implementation of methods, or even open a web browser to view the corresponding entry in the online SVN repository. (Note that the web repository is a backup often a day or two behind the status of what is available to developers.)</p>
88 <p class="p2"><br></p>
89 <p class="p8">SequenceableCollection<span class="s3">.browse;</span></p>
90 <p class="p2"><br></p>
91 <p class="p3">Selecting any method and pressing Cmd-y will open a window with a list of all the classes that <i>implement</i> that method. (See the <a href="Language/Polymorphism.html"><span class="s1">Polymorphism</span></a><b> </b>helpfile for detail on why different classes might implement methods with the same name.)</p>
92 <p class="p2"><br></p>
93 <p class="p7"><span class="s3">select </span>// try it on this method</p>
94 <p class="p2"><br></p>
95 <p class="p3">Similarly, selecting any text and typing shift-cmd-y will open a window showing all references to the selected text, i.e. each place it is used within the class library. (This will not find methods calls compiled with special byte codes like 'value'.)</p>
96 <p class="p2"><br></p>
97 <p class="p7">// try it on these</p>
98 <p class="p6">asStream<span class="Apple-converted-space"> </span></p>
99 <p class="p8">SCWindow</p>
100 <p class="p2"><br></p>
101 <p class="p3">In the resulting window selecting any class and method and pressing Cmd-j will take you to that method definition in that class definition. For example try selecting <span class="s4">Pattern-select</span> in the window resulting from the previous example. Note that SC supports defining methods in separate files, so a class' methods may be defined in more than one place. If you try Cmd-j on the following you will see that it will open a file called dumpFullInterface.sc rather than one called Class.sc (its main class definition file). The <span class="s4">+ </span><span class="s5">Class</span><span class="s4"> {...</span>. syntax indicates that these are additional methods.</p>
102 <p class="p2"><br></p>
103 <p class="p6">Class-dumpFullInterface</p>
104 <p class="p2"><br></p>
105 <p class="p3">If you know that a class responds to a particular message, you can use findRespondingMethod to find out which class it inherits the corresponding method from.</p>
106 <p class="p2"><br></p>
107 <p class="p7"><span class="s1">Array</span><span class="s3">.findRespondingMethodFor(</span><span class="s6">'select'</span><span class="s3">); </span>// you can Cmd-j on the result in the post window</p>
108 <p class="p2"><br></p>
109 <p class="p3">Similarly, helpFileForMethod will open the helpfile of the class in which the responding method is defined (if the helpfile exists). Note that this does not guarantee that the method is documented therein. As noted above, some documentation is incomplete, and some methods are 'private' or not intended for general use.</p>
110 <p class="p2"><br></p>
111 <p class="p7"><span class="s1">Array</span><span class="s3">.helpFileForMethod(</span><span class="s6">'select'</span><span class="s3">); </span>// this will open the Collection helpfile; scroll down for select</p>
112 <p class="p2"><br></p>
113 <p class="p3">In general poking around can be a good way to learn about how things work. See <a href="Other Topics/Internal-Snooping.html"><span class="s1">Internal-Snooping</span></a> for more advanced information about how to look 'under the hood.'</p>
114 <p class="p9"><br></p>
115 <p class="p4"><b>For Further Info</b></p>
116 <p class="p9"><br></p>
117 <p class="p10"><span class="s7">http://supercollider.sourceforge.net/</span></p>
118 <p class="p9"><br></p>
119 <p class="p3">A good starting place for figuring out how to do something are the numerous files in the Examples folder. The SuperCollider swiki is another good source of tips, examples, and information:</p>
120 <p class="p9"><br></p>
121 <p class="p10"><span class="s7">http://swiki.hfbk-hamburg.de:8888/MusicTechnology/6</span></p>
122 <p class="p9"><br></p>
123 <p class="p3">To edit or add pages on the swiki use: <span class="Apple-tab-span"> </span>username: sc <span class="Apple-tab-span"> </span>password: sc</p>
124 <p class="p2"><br></p>
125 <p class="p3">Further help can be obtained by subscribing and sending questions to the sc-users mailing list:</p>
126 <p class="p11"><br></p>
127 <p class="p10"><span class="s7">http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml</span></p>
128 <p class="p9"><br></p>
129 <p class="p3">An archive of the list can be searched from this page:</p>
130 <p class="p2"><br></p>
131 <p class="p10"><span class="s7">http://www.listarc.bham.ac.uk/lists/sc-users/search/</span></p>
132 <p class="p2"><br></p>
133 <p class="p3">Requests for documentation of undocumented methods or classes, as well as reports of errata, omissions, etc. in helpfiles can be sent to the user's list above. Bugs or Feature Requests can be filed here:</p>
134 <p class="p2"><br></p>
135 <p class="p10"><span class="s7">https://sourceforge.net/tracker2/?group_id=54622</span></p>
136 </body>
137 </html>