{"action":"created","issue":{"url":"https://api.github.com/repos/openfisca/openfisca-core/issues/348","labels_url":"https://api.github.com/repos/openfisca/openfisca-core/issues/348/labels{/name}","comments_url":"https://api.github.com/repos/openfisca/openfisca-core/issues/348/comments","events_url":"https://api.github.com/repos/openfisca/openfisca-core/issues/348/events","html_url":"https://github.com/openfisca/openfisca-core/pull/348","id":108689274,"number":348,"title":"Uniformize variable declaration : allow inputs to be declared as a formula without a function","user":{"login":"fpagnoux","id":11834997,"avatar_url":"https://avatars.githubusercontent.com/u/11834997?v=3","gravatar_id":"","url":"https://api.github.com/users/fpagnoux","html_url":"https://github.com/fpagnoux","followers_url":"https://api.github.com/users/fpagnoux/followers","following_url":"https://api.github.com/users/fpagnoux/following{/other_user}","gists_url":"https://api.github.com/users/fpagnoux/gists{/gist_id}","starred_url":"https://api.github.com/users/fpagnoux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fpagnoux/subscriptions","organizations_url":"https://api.github.com/users/fpagnoux/orgs","repos_url":"https://api.github.com/users/fpagnoux/repos","events_url":"https://api.github.com/users/fpagnoux/events{/privacy}","received_events_url":"https://api.github.com/users/fpagnoux/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-09-28T15:57:24Z","updated_at":"2015-09-29T17:09:28Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/openfisca/openfisca-core/pulls/348","html_url":"https://github.com/openfisca/openfisca-core/pull/348","diff_url":"https://github.com/openfisca/openfisca-core/pull/348.diff","patch_url":"https://github.com/openfisca/openfisca-core/pull/348.patch"},"body":"As discussed with @eraviart last Friday, declaring formulas and input in different ways has a few drawbacks :\r\n- More complexity for the developer, who has to know 2 ways of declaring a variable that look like each other with a slightly different syntax. \r\n- Possible mistakes (comas are needed in one syntax, not the other)\r\n- When looking for a variable declaration with a global text research, inputs are hard to find.\r\n\r\nIt would be nice if we could have only one syntax. A possible implementation (started here) is to just allow `SimpleFormulaColumn` to not have a function. \r\n\r\nBefore : \r\n```python\r\nreference_input_variable(\r\n    name = \"ass_precondition_remplie\",\r\n    column = BoolCol,\r\n    entity_class = Individus,\r\n    label = u\"Eligible à l'ASS\",\r\n    )\r\n\r\n@reference_formula\r\nclass ass(SimpleFormulaColumn):\r\n    column = FloatCol\r\n    label = u\"Montant de l'ASS pour une famille\"\r\n    entity_class = Familles\r\n\r\n    def function(self, simulation, period):\r\n         return period, x\r\n```\r\n\r\nAfter :\r\n\r\n```python\r\n@reference_formula\r\nclass ass_precondition_remplie(SimpleFormulaColumn):\r\n    column = BoolCol\r\n    entity_class = Individus\r\n    label = u\"Eligible à l'ASS\"\r\n\r\n@reference_formula\r\nclass ass(SimpleFormulaColumn):\r\n    column = FloatCol\r\n    label = u\"Montant de l'ASS pour une famille\"\r\n    entity_class = Familles\r\n\r\n    def function(self, simulation, period):\r\n         return period, x\r\n```"},"comment":{"url":"https://api.github.com/repos/openfisca/openfisca-core/issues/comments/144123604","html_url":"https://github.com/openfisca/openfisca-core/pull/348#issuecomment-144123604","issue_url":"https://api.github.com/repos/openfisca/openfisca-core/issues/348","id":144123604,"user":{"login":"cbenz","id":12686,"avatar_url":"https://avatars.githubusercontent.com/u/12686?v=3","gravatar_id":"","url":"https://api.github.com/users/cbenz","html_url":"https://github.com/cbenz","followers_url":"https://api.github.com/users/cbenz/followers","following_url":"https://api.github.com/users/cbenz/following{/other_user}","gists_url":"https://api.github.com/users/cbenz/gists{/gist_id}","starred_url":"https://api.github.com/users/cbenz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cbenz/subscriptions","organizations_url":"https://api.github.com/users/cbenz/orgs","repos_url":"https://api.github.com/users/cbenz/repos","events_url":"https://api.github.com/users/cbenz/events{/privacy}","received_events_url":"https://api.github.com/users/cbenz/received_events","type":"User","site_admin":false},"created_at":"2015-09-29T17:09:28Z","updated_at":"2015-09-29T17:09:28Z","body":"Furthermore I would suggest renaming even `@reference_formula` to `@reference_variable`, because a variable can have or not a formula. The formula *is* the function.\r\n\r\nWe could even replace the term *reference* by either *vanilla* (like @benjello says often), *country* or *tax_benefit_system*"}}