Changes between Version 68 and Version 69 of Records
- Timestamp:
- 05/19/12 08:03:12 (12 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Records
v68 v69 44 44 45 45 So we have decided to avoid the extensible record debate, but how can we have multiple record field selectors in scope and correctly resolve the type of the record? There are two main mechanisms on offer: 46 * '''Plan A''': Name spacing. This uses qualified names to disambiguate record field names.47 * '''Plan B''': Types. This uses types to disambigua ge record field names.46 * '''Plan A''': Namespacing. This uses qualified names to disambiguate record field names. 47 * '''Plan B''': Types. This uses types to disambiguate record field names. 48 48 49 49 1. '''[wiki:Records/OverloadedRecordFields Simple Overloaded Record Fields] (SORF)'''. Pure (Plan B). … … 86 86 * only very inefficient code could be generated, if you have to access or update a field of some unknown record. In the end, every record type was basically a map. 87 87 * it turned out that errors stemming from mistyping a field name often could not be diagnosed at the point where they were committed, but led to inferred types with crazy signatures and an incomprehensible type error at the use side of the function that contained the error. 88 * the extra constraints complicated the type checker and did not play well with higher kinded type variables (at least in the code I had then, I do not claim that this is nessecarily so).88 * the extra constraints complicated the type checker and did not play well with higher-kinded type variables (at least in the code I had then, I do not claim that this is necessarily so). 89 89 90 90 SORF without abstraction over fields may be able to avoid some of these potential downsides, and a judicious (no virtual fields, etc) implementation of either could look very similar to the programmer. … … 102 102 103 103 104 === Other ( FP) languages ===104 === Other (functional, and especially typeful) languages === 105 105 106 106 If you know of other relevant language implementations, please add them! … … 115 115 SML# supports [http://www.pllab.riec.tohoku.ac.jp/smlsharp/?FeatureRecordPolymorphism abstraction over fields] as per the overloaded records implementation. 116 116 117 [http://roy.brianmckenna.org/ Roy], a functional language that targets only javascript, also has structural typing which prevents clashes and allows abstraction over fields.117 [http://roy.brianmckenna.org/ Roy], a functional language that targets only Javascript, also has structural typing which prevents clashes and allows abstraction over fields. 118 118 119 [Ur/Web has a http://www.impredicative.com/ur/tutorial/tlc.html very advanced records system]. It is exaplained in [http://adam.chlipala.net/papers/UrPLDI10/UrPLDI10.pdf the UR implementation paper]. Edward Zhang attempts to explain it to Haskellers: http://blog.ezyang.com/2012/04/how-urweb-records-work-and-what-it-might-mean-for-haskell/comment-page-1/#comment-3669 119 Ur/Web has a [http://www.impredicative.com/ur/tutorial/tlc.html very advanced records system]. It is explained in [http://adam.chlipala.net/papers/UrPLDI10/UrPLDI10.pdf the Ur implementation paper] and in Edward Z. Yang's [http://blog.ezyang.com/2012/04/how-urweb-records-work-and-what-it-might-mean-for-haskell/ explanation for Haskellers]. 120 120 121 Other FP languages where I looked for a record implementation but it appeared they have no solution for records with the same fields (my information could be wrong/out-dated) ocaml, oz. However, the O in OCaml is for objects, and objects have structural typing that supports abstraction over fields.121 Other FP languages where I looked for a record implementation but it appeared they have no solution for records with the same fields (my information could be wrong/out-dated) OCaml, Oz. However, the O in OCaml is for objects, and objects have structural typing that supports abstraction over fields. 122 122 123 123 I couldn't find great specific information on record implementation ML variants other than SML#. Best I can tell, SML does not allow records in the same module with the same field. Records from other modules require name-spacing or must be opened up similar to Agda.
