Skip to content

Commit b3e50aa

Browse files
committed
upd
1 parent 4a90599 commit b3e50aa

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

src/overview/whack_ds.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,28 @@ x = [...x, 10] // pushes 10
114114
// never .push(10)
115115
```
116116

117+
In the same component, you may also define deriveds, like:
118+
119+
```sx
120+
public function add(n:double):void {
121+
x = [...x, n]
122+
}
123+
```
124+
125+
Then you can do:
126+
127+
```sx
128+
add(10)
129+
```
130+
131+
Anywhere in the component, although this is an insignificant example of how deriveds can be used.
132+
133+
> **Note**: ReactJS and Adobe Flex also present the same limitation.
134+
>
135+
> For a language compiler to implement any actual transitive immutability,
136+
> significant effort is required, and it may end up increasing the language
137+
> complexity.
138+
117139
## Callback caching
118140

119141
Whack DS caches callbacks (either lambdas, inline event handlers, instance methods of the same component or Functions declared inside the constructor) within applicable E4X attributes, since they are naturally ever changing `Function` objects regardless of whether they are lambdas or fixtures ─ for example, since they capture locals, `this` or ShockScript lexical contexts, they tend to return different `Function` objects ─ and this is crucial for memoization.

0 commit comments

Comments
 (0)