-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
var<float> val = 3.14f;
ref<int> val2 = val.convert([](float v){ return floor(v); }, [](int i){ return (float)i; });
ref<int> val3 = val2.convert([](int v){ return v+1;}, [](int i){ return i - |; });
ref<int> foo = 20.0f;
ref<int> foo2 = foo;
// ref can animate, set and get
var<float> val = 13.37f;
fun<float> val2 = {[](){ return val * 2.0f; }};
fun<float> val3 = {[](){ return val2 + 2.0f; }};
fun<int> foo = 10.0f;
fun<int> foo2 = foo;
// fun can only get, not animate or set
the discrepancy in the interface is due to the ref requiring a single context, while fun can use the lang context.
i think it might be useful to know whether something has a state or is derived in the type.
if you take a read-only parameter you take fun, if you need two way parameter you take ref
Metadata
Metadata
Assignees
Labels
No labels