You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Caching some work from the hackathon today. To enable propagating change hints when constructing objects which hold several values and unpacking values from these objects, we introduce a Construct(type) generative function, and a GetField(type, fieldname) generative function.
Usage example
@gen (static) functionfoo()
x ~normal(0, 1)
y ~normal(0, 1)
returnConstruct(Point2f0)(x, y)
end@gen (static) functionbar(p::Point2f0)
x ~GetField(Point2f0, :x)(p::Point2f0)
returnlong_computation(x)
end
We could add sugar so that if the user writes Point2f0(x, y), it is automatically converted to Construct(Point2f0)(x, y), and if the user writes point.x, it is converted to GetField(Point2f0, :x)(point)`.
Caching some work from the hackathon today. To enable propagating change hints when constructing objects which hold several values and unpacking values from these objects, we introduce a
Construct(type)
generative function, and aGetField(type, fieldname)
generative function.Usage example
We could add sugar so that if the user writes
Point2f0(x, y)
, it is automatically converted toConstruct(Point2f0)(x, y)
, and if the user writespoint.x, it is converted to
GetField(Point2f0, :x)(point)`.Here is an untested implementation:
The text was updated successfully, but these errors were encountered: