{"action":"opened","issue":{"url":"https://api.github.com/repos/JamesPHoughton/pysd/issues/83","repository_url":"https://api.github.com/repos/JamesPHoughton/pysd","labels_url":"https://api.github.com/repos/JamesPHoughton/pysd/issues/83/labels{/name}","comments_url":"https://api.github.com/repos/JamesPHoughton/pysd/issues/83/comments","events_url":"https://api.github.com/repos/JamesPHoughton/pysd/issues/83/events","html_url":"https://github.com/JamesPHoughton/pysd/issues/83","id":165815580,"number":83,"title":"Including expressions in delays gives a parsing error","user":{"login":"JamesPHoughton","id":4304478,"avatar_url":"https://avatars.githubusercontent.com/u/4304478?v=3","gravatar_id":"","url":"https://api.github.com/users/JamesPHoughton","html_url":"https://github.com/JamesPHoughton","followers_url":"https://api.github.com/users/JamesPHoughton/followers","following_url":"https://api.github.com/users/JamesPHoughton/following{/other_user}","gists_url":"https://api.github.com/users/JamesPHoughton/gists{/gist_id}","starred_url":"https://api.github.com/users/JamesPHoughton/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JamesPHoughton/subscriptions","organizations_url":"https://api.github.com/users/JamesPHoughton/orgs","repos_url":"https://api.github.com/users/JamesPHoughton/repos","events_url":"https://api.github.com/users/JamesPHoughton/events{/privacy}","received_events_url":"https://api.github.com/users/JamesPHoughton/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2016-07-15T15:34:46Z","updated_at":"2016-07-15T15:34:46Z","closed_at":null,"body":"Right now, we can delay functions, but delaying expressions or combinations of functions give us issues. For example, the Vensim element:\r\n```\r\nDelay Them=\r\n\tDELAY1( (Gen1 + Gen2) , 10 )\r\n\t~\t\r\n\t~\t\t|\r\n```\r\nTranslates as:\r\n```python\r\n@cache('step')\r\ndef delay_them():\r\n    ...\r\n    return _(gen1() + gen2(_delay_1()\r\n```\r\nClearly problematic. This will require some significant changes to `add_n_delay`, as an assumption I had made was that this function could only take the name of a variable, which is not true. It may end up being best to completely rework the way these macro functions are handled - something that I've been thinking about anyways.\r\n\r\nCurrent workaround to create a new variable in the model that contains the expression, and delay that variable.\r\n\r\nThanks @ourren for finding this one!\r\n\r\n\r\n"}}
{"actor":{"display_login":"JamesPHoughton"}}