pyteal
pyteal copied to clipboard
add method to encode tuple element
I just want bytes, no need for other scratch vars or lambdas
diff from a program where i switched to this:
I am still opinionated on this one tho, after some more thoughts. Maybe I am wrong.
This encode
method applies to all ComputedType
, so it also applies to ReturnedType
which wraps up a computation returning something on stack. What if the encode
called twice for a ReturnedType
instance with a computation that has side effect? That would not be ideal.
barnjamin can you please speak with Hang to elaborate his concerns regarding multiple instance requests of ReturnedType
@ahangsu correctly notes that if someone were to call something like encode
multiple times on a ReturnedValue
the computation
Expr would be run again.
However, this behavior is already present in the current release. While it isn't ideal I think it shouldn't be a show stopped for this pr. Perhaps another pr that improves how a ReturnedValue caches its computation (via scratch var or otherwise?) is warranted.
I forgot about this one, assuming the conflict is resolved is it good to merge?
cc @ahangsu @bbroder-algo