Closed nadako closed 4 years ago
Also I need some clarification about the deprecation of Promise/Future.NULL
, e.g. if I have:
var f:Future<String> = if (...) getActualFuture() else Future.NOISE;
f.handle(value -> /* should I check for `null` here? */);
To be honest I'd prefer something that is explicitly specified to resolve to a null
, especially given that Noise
can be anything because of from Dynamic
...
The code should not compile with null safety, because Future<Noise>
is merely Future<Null<String>>
.
And yeah, the from Dynamic
is new and should probably be given more thought. Probably @:from Dynamic return null
would be better.
So does that mean that Noise
is/should be specified to be null at run-time? ^^
Indeed. The whole point was to have only one value. I think :D
Hm, I wonder if it makes sense to have a cached instance of Outcome(Noise)
too (for Promise.noise
).
Why not ;)
Not necessarily, but it'd be a nice solution :)
Given that
Noise
hasfrom Dynamic
so this is possible:(and thus there's no guarantee that two
Noise
-typed values are equal)Shouldn't
Promise.noise
justreturn this
to save some allocations?