{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/15394","repository_url":"https://api.github.com/repos/JuliaLang/julia","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/15394/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/15394/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/15394/events","html_url":"https://github.com/JuliaLang/julia/pull/15394","id":139111607,"number":15394,"title":"RFC: Modifying base to play nicely with physical units","user":{"login":"ajkeller34","id":7145721,"avatar_url":"https://avatars.githubusercontent.com/u/7145721?v=3","gravatar_id":"","url":"https://api.github.com/users/ajkeller34","html_url":"https://github.com/ajkeller34","followers_url":"https://api.github.com/users/ajkeller34/followers","following_url":"https://api.github.com/users/ajkeller34/following{/other_user}","gists_url":"https://api.github.com/users/ajkeller34/gists{/gist_id}","starred_url":"https://api.github.com/users/ajkeller34/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajkeller34/subscriptions","organizations_url":"https://api.github.com/users/ajkeller34/orgs","repos_url":"https://api.github.com/users/ajkeller34/repos","events_url":"https://api.github.com/users/ajkeller34/events{/privacy}","received_events_url":"https://api.github.com/users/ajkeller34/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":21,"created_at":"2016-03-07T22:17:37Z","updated_at":"2016-04-01T14:15:13Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/JuliaLang/julia/pulls/15394","html_url":"https://github.com/JuliaLang/julia/pull/15394","diff_url":"https://github.com/JuliaLang/julia/pull/15394.diff","patch_url":"https://github.com/JuliaLang/julia/pull/15394.patch"},"body":"I'm interested and personally invested in getting Julia to support physical units. There are some places in base that could be modified to suppress the numerous override warnings that appear when using my physical unit package for Julia 0.5.0-dev, [Unitful.jl](https://github.com/ajkeller34/Unitful.jl). Advertisements aside, I believe some changes to base are going to be necessary for any units package that fully supports Ranges (`UnitRange`, `FloatRange`, etc.) to have a chance of integrating with Julia without emitting warnings. Here's a TL;DR version: `one(x)` is not logically the same as `oftype(x,1)` when working with quantities that have units (`one(x)` is defined as the multiplicative identity, which should not have units!), and sometimes we need to strip units for certain numerical operations and comparisons. This is especially obvious in `range.jl`.\r\n\r\nEncouraged by @StefanKarpinski in this [julia-users thread](https://groups.google.com/d/msg/julia-users/BT4bP5VyaRY/e3xdTRgsAgAJ), here are some changes to base I'd appreciate having comments on. The change to `complex.jl` is not as important as the changes to `number.jl` and `range.jl`. I built Julia using a few-day-old version of master and find no test regressions with my modifications. I could use some help with benchmarking, however. This is my first PR for Julia and while I have read the guidelines for contributions, please advise if I should be doing something differently.\r\n\r\nThanks!"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/204412822","html_url":"https://github.com/JuliaLang/julia/pull/15394#issuecomment-204412822","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/15394","id":204412822,"user":{"login":"timholy","id":1525481,"avatar_url":"https://avatars.githubusercontent.com/u/1525481?v=3","gravatar_id":"","url":"https://api.github.com/users/timholy","html_url":"https://github.com/timholy","followers_url":"https://api.github.com/users/timholy/followers","following_url":"https://api.github.com/users/timholy/following{/other_user}","gists_url":"https://api.github.com/users/timholy/gists{/gist_id}","starred_url":"https://api.github.com/users/timholy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timholy/subscriptions","organizations_url":"https://api.github.com/users/timholy/orgs","repos_url":"https://api.github.com/users/timholy/repos","events_url":"https://api.github.com/users/timholy/events{/privacy}","received_events_url":"https://api.github.com/users/timholy/received_events","type":"User","site_admin":false},"created_at":"2016-04-01T14:15:13Z","updated_at":"2016-04-01T14:15:13Z","body":":+1: to @ssfrr's final paragraph. @ajkeller34, I've certainly experienced similar frustrations in working with units, but I think the best answer is to get as far as you can without explicit unit-stripping and -adding functions. Then, file bugs against julia for those cases where you can't figure out a proper solution.\r\n\r\nThis has by far the best chance of a delightful outcome: by pointing out problems in specific places, and giving everyone a chance to scratch their collective heads, either (1) some bright person will come up with brilliant solutions that don't require code-uglification, or (2) everyone will give up and agree with you. Either way, you win. What's not to like? :smile:\r\n"}}