Skip to content

Commit 24f94c2

Browse files
committed
updates
1 parent 77e43f7 commit 24f94c2

File tree

1 file changed

+3
-13
lines changed

1 file changed

+3
-13
lines changed

text/0003-reactive-declarations.md

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ As an indirect consequence of that change, we're able to get rid of all the boil
5757

5858
The useful thing about computed properties is that they are only recalculated when their inputs change, side-stepping a common performance problem that affects some frameworks in which derived values must be recalculated on every render. Unlike some other frameworks that implement computed properties, the compiler is able to build a dependency graph of computed properties at *compile time*, enabling it to sort them topologically and generate highly efficient code that doesn't depend on expensive *run time* dependency tracking.
5959

60-
RFC 1 glosses over the loss of computed properties, suggesting that we could simply replace them with functions:
60+
RFC 1 initially glossed over the loss of computed properties, suggesting that we could simply replace them with functions:
6161

6262
```html
6363
<script>
@@ -172,15 +172,7 @@ Another consequence is that it's straightforward to include side-effects (`$: co
172172

173173
### Timing
174174

175-
Since reactive declarations are likely to depend on props passed into the component from outside, we probably don't want them to run immediately upon instantiation (when props aren't yet available).
176-
177-
> 🐃 There has been some discussion about whether we *should* make props available immediately, rather than waiting until the first update cycle. In other words,
178-
>
179-
> export let foo = 'fallback value';
180-
>
181-
> would be transformed by the compiler to something like
182-
>
183-
> let { foo = 'fallback value' } = $$props;
175+
Since reactive declarations are ordered topologically, we probably don't want them to run immediately in source order upon instantiation.
184176

185177
We also don't want to run them immediately upon every change. Recalculating `foo` after `bar` is updated...
186178

@@ -207,7 +199,7 @@ In Svelte 2, computed properties are read-only — attempting to write to them t
207199

208200
### Reactive stores
209201

210-
[RFC 2](https://github.com/sveltejs/rfcs/blob/svelte-observables/text/0002-observables.md) introduced a proposal for reactive stores (the naming is TBD; the title of that RFC is 'Svelte observables', but at one point the favoured name was 'sources'. For now I'll refer to them as reactive stores, for alignment with reactive assignments and declarations).
202+
[RFC 2](https://github.com/sveltejs/rfcs/blob/svelte-observables/text/0002-observables.md) introduced a proposal for reactive stores.
211203

212204
Briefly, the idea is that a reactive store exposes a `subscribe` method that can be used to track a value over time; *writable* stores would also expose methods like `set` and `update`. This allows application state to be stored outside the component tree, where appropriate. Inside templates, stores can be referenced with a `$` prefix that exposes their value:
213205

@@ -308,8 +300,6 @@ This shouldn't be the first thing that people encounter when learning Svelte —
308300

309301
When discussing reactive programming, it's useful to refer to existing implementations of the idea, including spreadsheets.
310302

311-
The naming and terminology are still TBD. 'Reactive declarations' makes sense to me as one leg of the reactive assignments/declarations/stores trinity, but better alternatives may exist. As for the label itself, I don't have a clear favourite, though I'm warming to `reactive:`.
312-
313303

314304
## Drawbacks
315305

0 commit comments

Comments
 (0)