-
Notifications
You must be signed in to change notification settings - Fork 36
[Merged by Bors] - Hotfixes after #309 #351
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 8 commits
ecf1e5d
917334b
29d692a
73962ad
9ee336b
ce0a3e8
59303d7
274aebb
ef0faa5
9ecb939
c4e91a0
9b32797
ad049c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -212,17 +212,23 @@ function submodel(prefix_expr, expr, ctx=esc(:__context__)) | |
if prefix_left !== :prefix | ||
error("$(prefix_left) is not a valid kwarg") | ||
end | ||
|
||
# The user expects `@submodel ...` to return the | ||
# return-value of the `...`, hence we need to capture | ||
# the return-value and handle it correctly. | ||
@gensym retval | ||
|
||
# `prefix=false` => don't prefix, i.e. do nothing to `ctx`. | ||
# `prefix=true` => automatically determine prefix. | ||
# `prefix=...` => use it. | ||
args_assign = getargs_assignment(expr) | ||
return if args_assign === nothing | ||
ctx = prefix_submodel_context(prefix, ctx) | ||
# In this case we only want to get the `__varinfo__`. | ||
quote | ||
$(esc(:__varinfo__)) = last( | ||
$(DynamicPPL._evaluate!!)($(esc(expr)), $(esc(:__varinfo__)), $(ctx)) | ||
$retval, $(esc(:__varinfo__)) = $(DynamicPPL._evaluate!!)( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like returning both the
Following this view, we no longer need to concern ourselves what is the semantics if the returned value There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm a bit confused. In both those cases we still have to concern ourselves with the return-value, no? Essentially the difference between Anyways, you're happy with this right? You're just talking about potentially also supporting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, happy with this PR. I think |
||
$(esc(expr)), $(esc(:__varinfo__)), $(ctx) | ||
) | ||
$retval | ||
end | ||
else | ||
L, R = args_assign | ||
|
@@ -235,9 +241,10 @@ function submodel(prefix_expr, expr, ctx=esc(:__context__)) | |
) | ||
end | ||
quote | ||
$(esc(L)), $(esc(:__varinfo__)) = $(DynamicPPL._evaluate!!)( | ||
$retval, $(esc(:__varinfo__)) = $(DynamicPPL._evaluate!!)( | ||
$(esc(R)), $(esc(:__varinfo__)), $(ctx) | ||
) | ||
$(esc(L)) = $retval | ||
end | ||
end | ||
end |
Uh oh!
There was an error while loading. Please reload this page.