-
Notifications
You must be signed in to change notification settings - Fork 22
/
documentation.fy
57 lines (38 loc) · 1.07 KB
/
documentation.fy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# documentation.fy
# Example about fancys built-in documentation facilities
class Foo {
"""
If first expression in a class body is an string literal
it is used as documentation.
"""
m = def foo: x bar: y (22) {
"Prints its own documentation."
"TODO: obtain methodContext and print own documentation" println
}
m documentation println
}
foo = Foo new
foo method: 'foo:bar: . documentation println
foo method: 'foo: . documentation println
def foo bar: n {
"A singleton method"
n println
}
foo method: 'bar: . documentation println
Foo instance_method: 'foo: . documentation println
Foo documentation println
block = |a, b| {
"A block can also have a documentation string, just like methods"
a + b
}
block documentation println
Math PI documentation: "An aproximation of the PI number"
Math PI documentation println
Fancy Documentation documentation println
Fancy Documentation for: Foo append: "Re-Openning Foo class to add more docs."
class Foo {
"""
Fancy provides an incremental documentation feature.
"""
self documentation println
}