1 | ---
|
2 | in_progress: yes
|
3 | default_highlighter: oils-sh
|
4 | ---
|
5 |
|
6 | YSH Objects - Modules, Closures, and More
|
7 | ===========
|
8 |
|
9 | - Objects
|
10 | - Proc-like objects with `__invoke__`
|
11 | - Func-like objects with `__call__`
|
12 | - Modules are invokable, with attributes
|
13 | - Closures TODO - callable
|
14 | - Blocks
|
15 | - These are "bare"
|
16 |
|
17 |
|
18 | <div id="toc">
|
19 | </div>
|
20 |
|
21 | ## Proc-Like
|
22 |
|
23 |
|
24 | ### Stateful Proc Counter
|
25 |
|
26 | ## Func-Like
|
27 |
|
28 | ### Stateful Func Counter
|
29 |
|
30 |
|
31 | ## Examples
|
32 |
|
33 | ### Procs - Modules
|
34 |
|
35 | invokable No state
|
36 |
|
37 |
|
38 | ### Funcs - Closures in a Loop
|
39 |
|
40 | The famous example.
|
41 |
|
42 | ### DSLs like Hay, Flag Parser, etc.
|
43 |
|
44 | These use procs and value.Obj?
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|