-
Notifications
You must be signed in to change notification settings - Fork 89
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
Accessing model variables from macro with trailing $
syntax
#143
Comments
Hi Olga, There seem to be two things going on here that I don't understand, both related to that
Do you have any insight into either of these? |
Appears that the
Because the macro parser is just the same as the model parser, we'll have to modify this to handle the differing model namespaces. The model may need to have some awareness of the fact that the macro 'reaches out' of its namespace, and may actually be responsible for inserting variables into that macro. This really breaks the paradigm of the macro as a function that can be called from the main body of the model. Why shouldn't these variables just be passed into the macro? The best way to do this in PySD (if we choose to support this) is to essentially rewrite the macro to include the Not sure if this would work. This type of thing would be ok: def outer():
i = 3
def inner():
print(i)
inner()
outer()
But I think the way the macro is instantiated, it would be a bit more like this: def inner():
return i + 1
def outer():
i = 3
return inner() + 1
outer()
@Heldera - do you have a sense for how ubiquitous this pattern is? Is it something that should really be supported, or can we get away with ignoring? |
$
syntax
Hi @Heldera, I think this bug should be corrected. If you still are experiencing it let me know. |
Sorry @Heldera, |
I have a model
integration3.mdl . When I try to run it I got following error:
Parse error at line "mean+white noise*std deviation*SQRT((2-time step$/correlation time)/(time step$/correlation time))", position: 30
Regards,
Olga from sdCloud.io
The text was updated successfully, but these errors were encountered: