@@ -18,6 +18,10 @@ Also see [Oil Keywords](oil-keywords.html).
18
18
19
19
This doc is filled with details, so it will help to keep these goals in mind:
20
20
21
+ - Code written in Oil style (with ` proc ` ) is easier to read/audit than code
22
+ written in shell style.
23
+ - in shell, functions can pollute the caller's stack, because of the dynamic
24
+ scope rule.
21
25
- Remove dynamic scope. This mechanism is unfamiliar to most programmers, and
22
26
may result in mutating variables where you don't expect it.
23
27
- Instead of using dynamic scope by default, Oil lets you choose it
@@ -59,7 +63,12 @@ Don't use the old style of `local`, `readonly`, `x=y`.
59
63
60
64
This covers 95%+ of shell programming.
61
65
62
- ### ` shopt --unset dynamic_scope ` in ` bin/oil `
66
+ ### When Dynamic Scope Is Off
67
+
68
+ ` shopt --unset dynamic_scope `
69
+
70
+ - it's off when calling a ` proc ` .
71
+ - it's off in ` bin/oil `
63
72
64
73
This option affects how nearly ** every** shell assignment construct behaves. There are a lot of them!
65
74
@@ -136,8 +145,11 @@ The other ones deal with values. These deal with cells. These also change to
136
145
- ` declare -p ` to print variables
137
146
- ` ${x@a} ` to print flags
138
147
- ` pp .cell `
148
+
139
149
- weird ` TZ ` test in ` printf ` . I think this could just look in the
140
150
environment itself? Do ` getenv() ` ?
151
+ - yeah I think this is a separate case
152
+ - I think it should just look for a GLOBAL honestly
141
153
142
154
143
155
### ` Dynamic ` &rarr ; ` LocalOnly ` (keyword ` setlocal ` )
0 commit comments