{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/vblang/issues/120","repository_url":"https://api.github.com/repos/dotnet/vblang","labels_url":"https://api.github.com/repos/dotnet/vblang/issues/120/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/vblang/issues/120/comments","events_url":"https://api.github.com/repos/dotnet/vblang/issues/120/events","html_url":"https://github.com/dotnet/vblang/issues/120","id":239345895,"number":120,"title":"Units of Measure","user":{"login":"AnthonyDGreen","id":10539978,"avatar_url":"https://avatars3.githubusercontent.com/u/10539978?v=4","gravatar_id":"","url":"https://api.github.com/users/AnthonyDGreen","html_url":"https://github.com/AnthonyDGreen","followers_url":"https://api.github.com/users/AnthonyDGreen/followers","following_url":"https://api.github.com/users/AnthonyDGreen/following{/other_user}","gists_url":"https://api.github.com/users/AnthonyDGreen/gists{/gist_id}","starred_url":"https://api.github.com/users/AnthonyDGreen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AnthonyDGreen/subscriptions","organizations_url":"https://api.github.com/users/AnthonyDGreen/orgs","repos_url":"https://api.github.com/users/AnthonyDGreen/repos","events_url":"https://api.github.com/users/AnthonyDGreen/events{/privacy}","received_events_url":"https://api.github.com/users/AnthonyDGreen/received_events","type":"User","site_admin":false},"labels":[{"id":521567546,"url":"https://api.github.com/repos/dotnet/vblang/labels/Proposal","name":"Proposal","color":"fef2c0","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":{"url":"https://api.github.com/repos/dotnet/vblang/milestones/3","html_url":"https://github.com/dotnet/vblang/milestone/3","labels_url":"https://api.github.com/repos/dotnet/vblang/milestones/3/labels","id":2263390,"number":3,"title":"Major release candidate","description":"These are features that seem most appropriate to release in a major language release (aligned with a release of Visual Studio). The next major release of the language would be VB16.","creator":{"login":"AnthonyDGreen","id":10539978,"avatar_url":"https://avatars3.githubusercontent.com/u/10539978?v=4","gravatar_id":"","url":"https://api.github.com/users/AnthonyDGreen","html_url":"https://github.com/AnthonyDGreen","followers_url":"https://api.github.com/users/AnthonyDGreen/followers","following_url":"https://api.github.com/users/AnthonyDGreen/following{/other_user}","gists_url":"https://api.github.com/users/AnthonyDGreen/gists{/gist_id}","starred_url":"https://api.github.com/users/AnthonyDGreen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AnthonyDGreen/subscriptions","organizations_url":"https://api.github.com/users/AnthonyDGreen/orgs","repos_url":"https://api.github.com/users/AnthonyDGreen/repos","events_url":"https://api.github.com/users/AnthonyDGreen/events{/privacy}","received_events_url":"https://api.github.com/users/AnthonyDGreen/received_events","type":"User","site_admin":false},"open_issues":22,"closed_issues":2,"state":"open","created_at":"2017-01-19T07:30:02Z","updated_at":"2017-11-01T21:16:44Z","due_on":null,"closed_at":null},"comments":7,"created_at":"2017-06-29T02:02:03Z","updated_at":"2017-11-04T02:47:45Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"This seems like it could be the kind of near-domain-specific feature that would benefit VB developers. This could useful to a host of practical applications. F# really sells the feature well here so hopefully we could borrow their design mostly intact (wouldn't it be even better if we could use F# libraries as-is?).\r\n\r\nRight now, the syntax that seems the least ambiguous is the backtick:\r\n\r\nObviously this is awesome for units of length and weight:\r\n```\r\nDim feet = 12`in\r\nDim ounce = 1`oz\r\nDim pound = 16`oz\r\nDim gallon = 4`qt\r\n```\r\n\r\nThis might also be awesome for units of currency:\r\n```\r\nDim minPrice = 1.00`USD\r\n```\r\n\r\nAnd maybe even other less concrete things like flavoring primitive types:\r\n\r\n```\r\nDim count = arr.Length`Count\r\nFor i = 0`Index to CType(count, Index)\r\n\r\nDim fs = \"Hello, {0}\"`FormatString\r\n```\r\n\r\nThings like counts vs indexes, localized vs non-localized strings, byte encodings, etc can be represented an enforced by units of measure rather than Hungarian notation (no offense to our Hungarian sisters and brothers--we love you Hungary! <3)\r\n\r\nI don't have a particular syntax for defining a unit in mind.\r\n\r\nOne thing I've been pondering is how this feature gels with VBs loose type conversion semantics. I've decided that even with `Option Strict Off` the feature isn't wasted because:\r\n\r\n1) impossible conversions will still give errors\r\n2) we could special case it if we wanted since it's a new thing\r\n3) a big benefit of the the feature isn't so much forcing you to write out conversions but ensuring that arithmetic is done correctly for the units involved. Put another way, it doesn't matter if the compiler converts inches to millimeters before adding, it matters that the conversion _happen_ before adding. Even if it happens implicitly you're still getting a numerically correct result.\r\n4) Since often conversions in both directions would be valid it might just be an ambiguity for the compiler to choose anyway."},"comment":{"url":"https://api.github.com/repos/dotnet/vblang/issues/comments/341866636","html_url":"https://github.com/dotnet/vblang/issues/120#issuecomment-341866636","issue_url":"https://api.github.com/repos/dotnet/vblang/issues/120","id":341866636,"user":{"login":"Bill-McC","id":8454020,"avatar_url":"https://avatars2.githubusercontent.com/u/8454020?v=4","gravatar_id":"","url":"https://api.github.com/users/Bill-McC","html_url":"https://github.com/Bill-McC","followers_url":"https://api.github.com/users/Bill-McC/followers","following_url":"https://api.github.com/users/Bill-McC/following{/other_user}","gists_url":"https://api.github.com/users/Bill-McC/gists{/gist_id}","starred_url":"https://api.github.com/users/Bill-McC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bill-McC/subscriptions","organizations_url":"https://api.github.com/users/Bill-McC/orgs","repos_url":"https://api.github.com/users/Bill-McC/repos","events_url":"https://api.github.com/users/Bill-McC/events{/privacy}","received_events_url":"https://api.github.com/users/Bill-McC/received_events","type":"User","site_admin":false},"created_at":"2017-11-04T02:47:45Z","updated_at":"2017-11-04T02:47:45Z","author_association":"NONE","body":"Don't like it. Would rather see a set of classes/structs as in keeping with timespan, rect or point etc\r\nIf you have a struct Distance, you could set/get the length in different supported units, .Metres, .Kilometres, .Feet, .Inches, etc, just like you can refer to a TimeSpan TotalSeconds. And you could have an Area type that takes two Distances, and a Volume type that takes three Distances.\r\nLikewsie and Angle type that has Degrees, Radians, and Grad.  And so on.\r\n\r\nI do not want them baked into the language, especially not currencies. Have had too many problems with DateTime's in the past. And imagine what happens if a currency is renamed, a country divides ?"}}
{"actor":{"display_login":"Bill-McC"}}