{"action":"created","issue":{"url":"https://api.github.com/repos/nengo/nengo/issues/901","labels_url":"https://api.github.com/repos/nengo/nengo/issues/901/labels{/name}","comments_url":"https://api.github.com/repos/nengo/nengo/issues/901/comments","events_url":"https://api.github.com/repos/nengo/nengo/issues/901/events","html_url":"https://github.com/nengo/nengo/issues/901","id":117608359,"number":901,"title":"Silly spa action should throw an error","user":{"login":"Seanny123","id":1918825,"avatar_url":"https://avatars.githubusercontent.com/u/1918825?v=3","gravatar_id":"","url":"https://api.github.com/users/Seanny123","html_url":"https://github.com/Seanny123","followers_url":"https://api.github.com/users/Seanny123/followers","following_url":"https://api.github.com/users/Seanny123/following{/other_user}","gists_url":"https://api.github.com/users/Seanny123/gists{/gist_id}","starred_url":"https://api.github.com/users/Seanny123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Seanny123/subscriptions","organizations_url":"https://api.github.com/users/Seanny123/orgs","repos_url":"https://api.github.com/users/Seanny123/repos","events_url":"https://api.github.com/users/Seanny123/events{/privacy}","received_events_url":"https://api.github.com/users/Seanny123/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/nengo/nengo/labels/bug","name":"bug","color":"000000"},{"url":"https://api.github.com/repos/nengo/nengo/labels/feature%20request","name":"feature request","color":"fef2c0"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-11-18T15:16:06Z","updated_at":"2015-11-18T16:11:22Z","closed_at":null,"body":"This code does not throw an error, despite the fact that any assignment that involves itself (in this case `mem=mem*ONE` and `mem=mem*~ONE`) is a bad idea.\r\n\r\n```\r\nimport nengo\r\nfrom nengo import spa\r\n\r\nfrom collections import OrderedDict\r\n\r\nD = 32\r\nvocab = spa.Vocabulary(D, unitary=[\"ONE\"])\r\nnumber_dict = {\"ONE\":1, \"TWO\":2, \"THREE\":3, \"FOUR\":4, \"FIVE\":5,\r\n               \"SIX\":6, \"SEVEN\":7, \"EIGHT\":8, \"NINE\":9}\r\nnumber_ordered = OrderedDict(sorted(number_dict.items(), key=lambda t: t[1]))\r\n\r\nnumber_range = 4\r\nvocab.parse(\"NONE\")\r\nvocab.parse(\"ONE\")\r\nnumber_list = number_ordered.keys()\r\nfor i in range(number_range):\r\n    vocab.add(number_list[i+1], vocab.parse(\"%s*ONE\" % number_list[i]))\r\n\r\nmodel = spa.SPA(vocab)\r\n\r\nwith model:\r\n    model.vision = spa.State(D)\r\n    model.motor = spa.State(D)\r\n    model.mem = spa.State(D, feedback=1)\r\n    \r\n    actions = spa.Actions(\r\n        \"dot(vision, START) --> mem=ONE\",\r\n        \"dot(vision, PLUS) --> mem=mem*ONE\",\r\n        \"dot(vision, MINUS) --> mem=mem*~ONE\",\r\n        \"dot(vision, DONE) --> motor=mem\"\r\n    )\r\n    \r\n    model.bg = spa.BasalGanglia(actions)\r\n    model.thal = spa.Thalamus(model.bg)\r\n```\r\n\r\nIt would be helpful to inform the user that this type of assignment is not allowed, since opening a feedback loop with a module not something `spa.Actions` is intended to do."},"comment":{"url":"https://api.github.com/repos/nengo/nengo/issues/comments/157763350","html_url":"https://github.com/nengo/nengo/issues/901#issuecomment-157763350","issue_url":"https://api.github.com/repos/nengo/nengo/issues/901","id":157763350,"user":{"login":"xchoo","id":1971583,"avatar_url":"https://avatars.githubusercontent.com/u/1971583?v=3","gravatar_id":"","url":"https://api.github.com/users/xchoo","html_url":"https://github.com/xchoo","followers_url":"https://api.github.com/users/xchoo/followers","following_url":"https://api.github.com/users/xchoo/following{/other_user}","gists_url":"https://api.github.com/users/xchoo/gists{/gist_id}","starred_url":"https://api.github.com/users/xchoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xchoo/subscriptions","organizations_url":"https://api.github.com/users/xchoo/orgs","repos_url":"https://api.github.com/users/xchoo/repos","events_url":"https://api.github.com/users/xchoo/events{/privacy}","received_events_url":"https://api.github.com/users/xchoo/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T16:11:22Z","updated_at":"2015-11-18T16:11:22Z","body":"Why is this having a recurrent statement a bad idea? The spa actions module is just doing what is was told to do. "}}