4 ms·
`const` applies to a binding; `readonly` applies to a property. The difference is important because you can alias a mutable property through a readonly referenc
by RyanCavanaugh 10y ago
`const` applies to a binding; `readonly` applies to a property. The difference is important because you can alias a mutable property through a readonly reference (thus observing two different values from the same reference if someone with a mutable handle on the object changes it), whereas a const will always have the same value because it's an immutable reference to a particular value/object.
- leeoniya 10y agoah i guess immutable aliasing is useful. then it's more powerful than const and can replace it wholesale, bindings included.