Closed as not planned
Closed as not planned
Description
Describe the problem
While $derived()
is a welcomed Rune addition, I don't quite understand why it has a confusing syntax of:
const area = $derived(width * height)
Multi line code ends up adding way too much noise too, as it requires an IIFE:
const area = $derived((() => {
return width * height
})())
Describe the proposed solution
It would be much more idiomatic in JavaScript for it to accept a function with a return value, so:
const area = $derived(() => width * height)
This is also more flexible for multiline code:
const area = $derived(() => {
return width * height
})
Alternatives considered
There's no alternative in Runes that I'm aware of.
Importance
would make my life easier
Metadata
Metadata
Assignees
Labels
No labels