Closed str4d closed 6 years ago
Before this PR, structs would need to make their internal Variable public, and users of the structs would write:
LinearCombination::zero() + CS::one() - (j.d, tau.var)
After this PR, structs expose their internal Variable via the trait, and users instead write:
LinearCombination::zero() + CS::one() - (j.d, &tau)
I looked into making this more of a DSL:
LinearCombination::zero() + CS::one() - j.d * &tau
This can only be implemented by the struct author, not generically by bellman. Additionally, it only works if the struct takes E: Engine
as a specialisation (so e.g. for Num<E>
but not Bit
).
This seems to provide for wrapped variables in general, with typed variables only being one possible application. Perhaps the trait name should be WrappedVariable
.
:umbrella: The latest upstream changes (presumably 6d55a4052a70b058f5b9b4762e023e6234e778dc) made this pull request unmergeable. Please resolve the merge conflicts.
I'm closing this because it appears bellman doesn't really need to provide any of this stuff, AFAIK. If you see a use case for it that can't be achieved with other abstractions, let me know.
This enables bellman users to implement structs that wrap Variables, and can interact with LinearCombination as if they were Variables.