Changes between Version 68 and Version 69 of Records


Ignore:
Timestamp:
May 19, 2012 3:03:12 PM (3 years ago)
Author:
guest
Comment:

copyediting

Legend:

Unmodified
Added
Removed
Modified
  • Records

    v68 v69  
    4444
    4545So 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 disambiguage 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.
    4848
    4949 1. '''[wiki:Records/OverloadedRecordFields Simple Overloaded Record Fields] (SORF)'''.  Pure (Plan B).
     
    8686    * 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.
    8787    * 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).
    8989
    9090SORF 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.
     
    102102
    103103
    104 === Other (FP) languages ===
     104=== Other (functional, and especially typeful) languages ===
    105105
    106106If you know of other relevant language implementations, please add them!
     
    115115SML# supports [http://www.pllab.riec.tohoku.ac.jp/smlsharp/?FeatureRecordPolymorphism abstraction over fields] as per the overloaded records implementation.
    116116
    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.
    118118
    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
     119Ur/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].
    120120
    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.
     121Other 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.
    122122
    123123I 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.