| 1 |
// name: help.ck |
| 2 |
// (available in chuck-1.4.1.0 and later) |
| 3 |
// desc: example showing .help(), which can be invoked on |
| 4 |
// any object or class; .help() dynamically generates |
| 5 |
// information regarding the underlying type of an object |
| 6 |
// or a class and outputs this information to the console. |
| 7 |
// the information includes the inheritance chain of the |
| 8 |
// type in question, its functions as well as functions |
| 9 |
// inherited from its parent (and its parent's parent, and |
| 10 |
// so on). |
| 11 |
// |
| 12 |
// .help() is designed to be a run-time teaching/learning tool |
| 13 |
// and a quick referencewhile programming. It's fun, sort of! |
| 14 |
|
| 15 |
// an object/ugen instance |
| 16 |
SinOsc osc; |
| 17 |
// call help() on it to learn about its underlying information |
| 18 |
osc.help(); |
| 19 |
|
| 20 |
// help() can be called directly on classes without instances |
| 21 |
Machine.help(); |
| 22 |
|
| 23 |
// 2-d int array |
| 24 |
int a[10][10]; |
| 25 |
// calling apropros on a 2d-array |
| 26 |
a.help(); |
| 27 |
// calling apropros on an array |
| 28 |
a[0].help(); |
| 29 |
|
| 30 |
// a user-created class |
| 31 |
public class Foo |
| 32 |
{ |
| 33 |
fun void bar() |
| 34 |
{ <<< "hi" >>>; } |
| 35 |
} |
| 36 |
// calling help() on the class |
| 37 |
Foo.help(); |