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
Is there really a need for the gen macro @splice? It seems like a new concept that can be avoided by reusing @addr. (Moreover, the name is confusing since it is not clear what is being "spliced"---the address---so it should be probably called @addr_splice at least.)
A suggested design which seems cleaner and reuses @addr is to use a sentinel value e.g. the empty tuple (), or nothing as an indicator for requesting splice:
@genfunctionbar_splice()
@addr(bernoulli(0.5), :x)
@addr(foo(), ())
end
and this way there is no need both @addr and @splice.
The text was updated successfully, but these errors were encountered:
This more clearly distinguishes the hierarchical namespace case from the splicing case, than using a reserved address token to represent splicing.
Currently, all Julia values are valid address tokens, and it seems very desirable to keep it this way. This would prohibit using some reserved value like () or nothing to indicate the need to splice.
I think either is fine. When I considered @addr(foo()) my sense was that having a special token e.g. @addr(foo, ()) is more consistent with the usual syntax @addr(foo(), :r). Concerns with having nothing i.e. @addr(foo()) are
(i) it might suggest the addresses are gobbled or untraced, as opposed to being prefixed by nothing and "spliced" into the current namespace; and
(ii) something like @addr(normal(0,1)) won't work (although neither will @splice(normal(0,1) so that is probably okay).
I can see the advantage of having all Julia values as valid address tokens (although it is rather strange that Julia allows Dicts to be keyed by mutable structures like a list, unlike Python which will claim list is unhashable).
As of probcomp/GenExperimental.jl#67, @splice(expr) is replaced with @trace(expr) (i.e. the form of @trace, which replaces @addr, but without an address).
Is there really a need for the gen macro
@splice
? It seems like a new concept that can be avoided by reusing@addr
. (Moreover, the name is confusing since it is not clear what is being "spliced"---the address---so it should be probably called@addr_splice
at least.)A suggested design which seems cleaner and reuses
@addr
is to use a sentinel value e.g. the empty tuple()
, ornothing
as an indicator for requesting splice:and this way there is no need both
@addr
and@splice
.The text was updated successfully, but these errors were encountered: