{"action":"opened","issue":{"url":"https://api.github.com/repos/gama-platform/gama/issues/1566","repository_url":"https://api.github.com/repos/gama-platform/gama","labels_url":"https://api.github.com/repos/gama-platform/gama/issues/1566/labels{/name}","comments_url":"https://api.github.com/repos/gama-platform/gama/issues/1566/comments","events_url":"https://api.github.com/repos/gama-platform/gama/issues/1566/events","html_url":"https://github.com/gama-platform/gama/issues/1566","id":135378102,"number":1566,"title":"Use units in a more explicit way","user":{"login":"AlexisDrogoul","id":579256,"avatar_url":"https://avatars.githubusercontent.com/u/579256?v=3","gravatar_id":"","url":"https://api.github.com/users/AlexisDrogoul","html_url":"https://github.com/AlexisDrogoul","followers_url":"https://api.github.com/users/AlexisDrogoul/followers","following_url":"https://api.github.com/users/AlexisDrogoul/following{/other_user}","gists_url":"https://api.github.com/users/AlexisDrogoul/gists{/gist_id}","starred_url":"https://api.github.com/users/AlexisDrogoul/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlexisDrogoul/subscriptions","organizations_url":"https://api.github.com/users/AlexisDrogoul/orgs","repos_url":"https://api.github.com/users/AlexisDrogoul/repos","events_url":"https://api.github.com/users/AlexisDrogoul/events{/privacy}","received_events_url":"https://api.github.com/users/AlexisDrogoul/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/gama-platform/gama/labels/%3E%20Enhancement","name":"> Enhancement","color":"009800"},{"url":"https://api.github.com/repos/gama-platform/gama/labels/Affects%20Usability","name":"Affects Usability","color":"eb6420"},{"url":"https://api.github.com/repos/gama-platform/gama/labels/Concerns%20GAML","name":"Concerns GAML","color":"207de5"},{"url":"https://api.github.com/repos/gama-platform/gama/labels/Concerns%20Modeling","name":"Concerns Modeling","color":"207de5"},{"url":"https://api.github.com/repos/gama-platform/gama/labels/OS%20All","name":"OS All","color":"bfdadc"},{"url":"https://api.github.com/repos/gama-platform/gama/labels/Priority%20Medium","name":"Priority Medium","color":"fad8c7"},{"url":"https://api.github.com/repos/gama-platform/gama/labels/Version%20Git","name":"Version Git","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-02-22T10:29:46Z","updated_at":"2016-02-22T10:29:46Z","closed_at":null,"body":"Right now, units (like `#km`, `#hour`) are mostly used for computation. While they work quite nicely, they are not explicit in the sense that a variable does not know in which unit it has been expressed. This information however can be important for the user, esp. when displaying values (`10 #m/#s` is more explicit than `0,002777777778`…)\r\n\r\nThis could be done by adding to attributes/variables a new facet (`unit:`), which would represent their unit. For instance:\r\n\r\n`float a <- 100 unit: #km/#h;`\r\n\r\nThe internal value kept by the variable would be 100, but whenever it would be used in a computation, it would compute its \"actual\" value (`27,7777…`) and `stringValue(…)` and `serialize(…)` would return `100 #km/#h`. \r\n\r\nThe omission of `unit:` would simply signify that the value is to be considered as expressed in the default unit. \r\n\r\nThe same would be true if the variable is used in computations:\r\n\r\n`float b <- a + 10;` would be interpreted as `100 #km/#h + 10#m/#s` (the latter being the default units of distance and time).\r\n`float b <- a + 10 #km/#h`  would be correctly interpreted.\r\n\r\nTo do that, we need to change the getValue() and setValue() of numeric variables to take into account their unit (if present): getting the value would return the 'internal' value multiplied by the value of the unit, setting a value would divide it by the unit first, and then assign the result to the 'internal' value.\r\n\r\nAny comment ? ( @gama-platform/committers / @gama-platform/core )"}}