{"action":"created","issue":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/964","labels_url":"https://api.github.com/repos/lampepfl/dotty/issues/964/labels{/name}","comments_url":"https://api.github.com/repos/lampepfl/dotty/issues/964/comments","events_url":"https://api.github.com/repos/lampepfl/dotty/issues/964/events","html_url":"https://github.com/lampepfl/dotty/issues/964","id":117595218,"number":964,"title":"Add Records To Dotty","user":{"login":"odersky","id":795990,"avatar_url":"https://avatars.githubusercontent.com/u/795990?v=3","gravatar_id":"","url":"https://api.github.com/users/odersky","html_url":"https://github.com/odersky","followers_url":"https://api.github.com/users/odersky/followers","following_url":"https://api.github.com/users/odersky/following{/other_user}","gists_url":"https://api.github.com/users/odersky/gists{/gist_id}","starred_url":"https://api.github.com/users/odersky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odersky/subscriptions","organizations_url":"https://api.github.com/users/odersky/orgs","repos_url":"https://api.github.com/users/odersky/repos","events_url":"https://api.github.com/users/odersky/events{/privacy}","received_events_url":"https://api.github.com/users/odersky/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/lampepfl/dotty/labels/Language%20Enhancement","name":"Language Enhancement","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-11-18T14:13:09Z","updated_at":"2015-11-19T18:43:44Z","closed_at":null,"body":"This is a rough sketch of a possible design of records for Dotty\r\n\r\n## Types\r\n\r\nA _single-field record type_ is of the form `(a: T)` where `a` is an identifier and `T` is a type. It expands into an instance of a trait `Labelled$a[T]`. We assume that for every field name `a` present in a program the following trait will be automatically generated:\r\n\r\n    trait Labelled$a[+T](val a: T)\r\n\r\nA _multi-field record type_ `(a_1: T_1, ..., a_n: T_n)` is equivalent to the intersection of single-field record types `(a_1: T_1) & ... & (a_n: T_n)`. Since `&` is commutative, order of fields does not matter.\r\n\r\nA _row type_ is a tuple of label/value pairs. Each label is a string literal. Unlike for record types, order of labels does matter in a row type.\r\n\r\nThe base trait `Record` is defined as follows:\r\n\r\n    trait Record { def row: Row }\r\n\r\nHere, `Row` is assumed to be a generic base type of HLists. Record values are instances of `Record` types that refine the type of `row`.\r\n\r\n## Values\r\n\r\nA record value is of the form `(a_1 = v_1, ..., a_n = v_n)`. Assuming the values `v_i` have types `T_i` this is a shorthand for\r\n\r\n    new Record with\r\n            Labelled$a_1[T_1](v_1) with ...\r\n            ...\r\n            Labelled$a_n[T_n](v_n) {\r\n       def row = ((\"a_1\", a_1), ..., (\"a_n\", a_n))\r\n    }\r\n         \r\nTODO: Define equality\r\nTODO: Define how to create a record value from a generic HList representation -  on the JDK it seems\r\nwe can use Java's Proxy mechanism for this.\r\n"},"comment":{"url":"https://api.github.com/repos/lampepfl/dotty/issues/comments/158151859","html_url":"https://github.com/lampepfl/dotty/issues/964#issuecomment-158151859","issue_url":"https://api.github.com/repos/lampepfl/dotty/issues/964","id":158151859,"user":{"login":"odersky","id":795990,"avatar_url":"https://avatars.githubusercontent.com/u/795990?v=3","gravatar_id":"","url":"https://api.github.com/users/odersky","html_url":"https://github.com/odersky","followers_url":"https://api.github.com/users/odersky/followers","following_url":"https://api.github.com/users/odersky/following{/other_user}","gists_url":"https://api.github.com/users/odersky/gists{/gist_id}","starred_url":"https://api.github.com/users/odersky/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/odersky/subscriptions","organizations_url":"https://api.github.com/users/odersky/orgs","repos_url":"https://api.github.com/users/odersky/repos","events_url":"https://api.github.com/users/odersky/events{/privacy}","received_events_url":"https://api.github.com/users/odersky/received_events","type":"User","site_admin":false},"created_at":"2015-11-19T18:43:44Z","updated_at":"2015-11-19T18:43:44Z","body":"@szeiger I weakened the language to admit other implementation schemes that would not rely on class generation. Classloaders are really a nuisance, it would be so nice to be able to ignore them. Maybe using the upcoming(?) ClassDynamic?"}}