{"action":"created","issue":{"url":"https://api.github.com/repos/flix/flix/issues/506","repository_url":"https://api.github.com/repos/flix/flix","labels_url":"https://api.github.com/repos/flix/flix/issues/506/labels{/name}","comments_url":"https://api.github.com/repos/flix/flix/issues/506/comments","events_url":"https://api.github.com/repos/flix/flix/issues/506/events","html_url":"https://github.com/flix/flix/issues/506","id":247108054,"number":506,"title":"Introduce SemanticOperator","user":{"login":"magnus-madsen","id":2287953,"avatar_url":"https://avatars2.githubusercontent.com/u/2287953?v=4","gravatar_id":"","url":"https://api.github.com/users/magnus-madsen","html_url":"https://github.com/magnus-madsen","followers_url":"https://api.github.com/users/magnus-madsen/followers","following_url":"https://api.github.com/users/magnus-madsen/following{/other_user}","gists_url":"https://api.github.com/users/magnus-madsen/gists{/gist_id}","starred_url":"https://api.github.com/users/magnus-madsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magnus-madsen/subscriptions","organizations_url":"https://api.github.com/users/magnus-madsen/orgs","repos_url":"https://api.github.com/users/magnus-madsen/repos","events_url":"https://api.github.com/users/magnus-madsen/events{/privacy}","received_events_url":"https://api.github.com/users/magnus-madsen/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"magnus-madsen","id":2287953,"avatar_url":"https://avatars2.githubusercontent.com/u/2287953?v=4","gravatar_id":"","url":"https://api.github.com/users/magnus-madsen","html_url":"https://github.com/magnus-madsen","followers_url":"https://api.github.com/users/magnus-madsen/followers","following_url":"https://api.github.com/users/magnus-madsen/following{/other_user}","gists_url":"https://api.github.com/users/magnus-madsen/gists{/gist_id}","starred_url":"https://api.github.com/users/magnus-madsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magnus-madsen/subscriptions","organizations_url":"https://api.github.com/users/magnus-madsen/orgs","repos_url":"https://api.github.com/users/magnus-madsen/repos","events_url":"https://api.github.com/users/magnus-madsen/events{/privacy}","received_events_url":"https://api.github.com/users/magnus-madsen/received_events","type":"User","site_admin":false},"assignees":[{"login":"magnus-madsen","id":2287953,"avatar_url":"https://avatars2.githubusercontent.com/u/2287953?v=4","gravatar_id":"","url":"https://api.github.com/users/magnus-madsen","html_url":"https://github.com/magnus-madsen","followers_url":"https://api.github.com/users/magnus-madsen/followers","following_url":"https://api.github.com/users/magnus-madsen/following{/other_user}","gists_url":"https://api.github.com/users/magnus-madsen/gists{/gist_id}","starred_url":"https://api.github.com/users/magnus-madsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magnus-madsen/subscriptions","organizations_url":"https://api.github.com/users/magnus-madsen/orgs","repos_url":"https://api.github.com/users/magnus-madsen/repos","events_url":"https://api.github.com/users/magnus-madsen/events{/privacy}","received_events_url":"https://api.github.com/users/magnus-madsen/received_events","type":"User","site_admin":false}],"milestone":null,"comments":3,"created_at":"2017-08-01T15:26:11Z","updated_at":"2017-08-24T19:06:13Z","closed_at":null,"body":"We currently have a class `Operator` and `BinaryOperator`:\r\n\r\n```\r\nobject BinaryOperator {\r\n\r\n  case object Plus extends ArithmeticOperator\r\n\r\n  ...\r\n}\r\n```\r\n\r\nThe problem with this approach is that `Plus` is overloaded. Is it plus on `Int32` or on `Float64`? Consequently, the backend relies on types to determine the meaning of an operator. It would be better to introduce a `SemanticOperator` like so:\r\n\r\n```\r\nsealed trait SemanticOperator\r\n\r\nobject SemanticOperator {\r\n\r\n  object Int32 {\r\n    case object Add extends SemanticOperator  \r\n    case object Sub extends SemanticOperator  \r\n  }\r\n\r\n  object BigInt {\r\n    case object Add extends SemanticOperator  \r\n    case object Sub extends SemanticOperator  \r\n   }\r\n\r\n}\r\n```\r\n\r\nor similar."},"comment":{"url":"https://api.github.com/repos/flix/flix/issues/comments/324728071","html_url":"https://github.com/flix/flix/issues/506#issuecomment-324728071","issue_url":"https://api.github.com/repos/flix/flix/issues/506","id":324728071,"user":{"login":"magnus-madsen","id":2287953,"avatar_url":"https://avatars2.githubusercontent.com/u/2287953?v=4","gravatar_id":"","url":"https://api.github.com/users/magnus-madsen","html_url":"https://github.com/magnus-madsen","followers_url":"https://api.github.com/users/magnus-madsen/followers","following_url":"https://api.github.com/users/magnus-madsen/following{/other_user}","gists_url":"https://api.github.com/users/magnus-madsen/gists{/gist_id}","starred_url":"https://api.github.com/users/magnus-madsen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/magnus-madsen/subscriptions","organizations_url":"https://api.github.com/users/magnus-madsen/orgs","repos_url":"https://api.github.com/users/magnus-madsen/repos","events_url":"https://api.github.com/users/magnus-madsen/events{/privacy}","received_events_url":"https://api.github.com/users/magnus-madsen/received_events","type":"User","site_admin":false},"created_at":"2017-08-24T19:06:13Z","updated_at":"2017-08-24T19:06:13Z","body":"Basically, the SemanticOperator replaces then need for inspecting types when generating code and should make the implementation more clean (and correct):\r\n\r\nhttps://github.com/flix/flix/blob/master/main/src/ca/uwaterloo/flix/language/ast/SemanticOperator.scala"}}
{"actor":{"display_login":"magnus-madsen"}}