New candidate JEP: 506: Scoped Values
Andrew Haley
aph-open at littlepinkcloud.com
Wed Apr 16 20:10:05 UTC 2025
On 16/04/2025 15:43, Adam Gent wrote:
> I highly suspect that most people will use ScopedValue like ScopedValue<SomeObject!> implicitly till Valhalla e.g. not binding null.
>
> There will be folks possibly like myself who use it like Optional eg:
>
> ScopedValue<SomeObject /* ! */> scopedValue = ...
> // later
> switch(scopeValue.orElse(null)) {
> }
In most cases, an unbound ScopedValue::get() is a programming error, like an
uninitialized variable, rather than something you'd expect in the "normal"
course of events. The exception to this is described in the JEP as "recursion
detection", for example flattened transactions.
> Like I said earlier this will be my last post on the topic so apologies if this is distracting.
Be my guest! I'm happy to talk about ScopedValue all day. I only regret that
we're having this conversation now, rather than 3 months ago when I suggested
you come here to talk.
Andrew.
More information about the loom-dev
mailing list