-
Notifications
You must be signed in to change notification settings - Fork 37
Description
Currently, when a user defines a model
@model function test(x, y)
x ~ Normal(0, 1)
y ~ Normal(x, 1)
endthen we define both test(x, y) = ModelGen(....) and test(; x, y) = test(x, y). Since we do not define an arbitrary macro syntax but parse Julia functions, we should maybe stick more to the Julia syntax for functions and respect the user-provided function signatures, i.e., only define the function test(x, y) if the user only provides keyword arguments. If the user wants a function with keyword arguments, she would have to write
@model function test(; x, y)
x ~ Normal(0, 1)
y ~ Normal(x, 1)
endinstead. Users could still provide default arguments for both positional and keyword arguments but the behaviour would be the same as for a regular Julia function - keyword arguments you can specify in any order but positional arguments require a user to specify arguments in a specific order. Internally we would still keep a named tuple of all arguments (positional + keyword arguments), so the change would only be user-facing by not providing more definitions of test than what the user wrote down explicitly. IMO that would be less surprising for users since @model would not change anymore how the function signature is interpreted.
@mohamed82008 mentioned on Slack that this might cause problems with the string macros (logpdf"...." etc.). Can you elaborate what you had in mind? I assumed it would not affect any functionality but just require you to specify test(missing, missing) explicitly if x and y are not observed.