Closed wipascal closed 2 years ago
Hmmm... I see why you need something like this. But I would prefer if we could keep the API to a single class or function for rendering values. We could solve this by makeing the ObjectFieldValue slightly more generic.
object = hg.resolve_lazy(super().resolve(context))
Then we can pass in any lazy value.
I don't fully understand what you mean. Would ObjectFieldValue
then extend Lazy
instead of ContextFunction
?
Not necessarily but I guess it would make sense in order keep the code easier to understand.
In that case you would not call super()
, but still need to run the code that is inside ContextValue.resolve
. (I think violating the DYI principle is justified here).
Actually ObjectFieldValue
started as a simple "extension" of ContextValue
but now it is evolving into a more generic value-formatting tool. Which is better than having a range of options to format values.
Das wäre etwa, was ich vorschlagen würde (parameter-name und doc-string muss ich noch anpassen).
Das wäre etwa, was ich vorschlagen würde (parameter-name und doc-string muss ich noch anpassen).
passt, ist definitiv besser als so wie ich gedacht hatte dass du es möchtest.
Okay, great (ups, switched to german before :D)
I have a usecase for this in an upcoming PR. (edit: this is the PR https://github.com/basxsoftwareassociation/ponds_next/pull/2)