Closed Jolanrensen closed 1 year ago
Let's remove withValue
from update (neat deprecation with ReplaceWith ofc)
and remove it everywhere in the docs
Hm, i have concerns about deprecation of this method because we can break examples in notebooks (especially in datalore) and there is at least one screenshot of some code in docs
Well, we can change those right? Good to know but it doesn't seem like a showstopper :)
Aah wait, Update.withValue
does have some use, namely keeping the type and nullability the same :) with {}
allows the type to change.
Btw Update.asNullable
is fairly useless. All it does is cast Update<T, C>
-> Update<T, C?>
.
This is then only useful for Update.asNullable().withValue(null)
because withValue
expects an exact type match. But we can just as easily allow withValue
to change nullability or just make users use with { null }
since that allows all type/nullability changes.
Well, we can change those right? Good to know but it doesn't seem like a showstopper :)
Sure, just something to keep in mind
Regarding nullability, if with
indeed allows nullability change, then asNullable
looks like a leftover. Maybe it wasn't always possible. I vaguely remember there were design discussions about it, but i don't remember the final decision.
Also, apart from withValue
we also have withZero
, withNull
.
Yes, I'm indifferent to keep or remove withZero
and withNull
. Could be a handy addition since it's less typing than with { 0.0 }
especially if autocompleted. I see more use in those than withValue(value)
Originally withValue
was added to support possible performance optimizations, for example when user fills a long column with a single constant value (#291 )
@Jolanrensen please revisit this
Some functions in the API have the option
withValue
such asupdate { something }.withValue(value)
while other functions, such asconvert {}
say they have it in the docs, yet don't.We need to either add
withValue
everywhere awith
occurs or just removewithValue
from the entire API sincewith { value }
does the same thing.