Changes between Version 39 and Version 40 of Records


Ignore:
Timestamp:
Jan 22, 2012 8:28:10 PM (2 years ago)
Author:
GregWeber
Comment:

update with Agda

Legend:

Unmodified
Added
Removed
Modified
  • Records

    v39 v40  
    3838 
    3939 1. '''[wiki:Records/OverloadedRecordFields Simple Overloaded Record Fields] (SORF)'''.  Pure (Plan B). 
    40  2. '''[wiki:Records/NameSpacing Frege-derived Records] (FDR)'''.  Uses (Plan A) + (Plan B). 
    41  3. '''[http://hackage.haskell.org/trac/haskell-prime/wiki/TypeDirectedNameResolution Type Directed Name Resolution] (TDNR)'''.  Pure (Plan B), but without abstraction. 
    42  3. '''Are there any other approaches?''' 
     40 2. '''[http://hackage.haskell.org/trac/haskell-prime/wiki/TypeDirectedNameResolution Type Directed Name Resolution] (TDNR)'''.  Pure (Plan B), but without abstraction over fields of the same name. 
     41 3. '''[wiki:Records/NameSpacing Agda style Records] (FDR)''' Pure (Plan A) 
     42 4. '''[wiki:Records/NameSpacing Frege-derived Records] (FDR)'''.  Uses (Plan A) + (Plan B). 
     43 
     44 5. '''Are there any other approaches?''' 
    4345 
    4446 
     
    5052=== Comparisons === 
    5153 
    52 The benefit of Overloading over Namespacing is being able to write code that works against any Record with a given field. So I can have a function: 
     54The benefit of abstracting over field names in Overloading is being able to write code that works against any Record with a given field. So I can have a function: 
    5355 
    5456{{{ 
     
    5759 
    5860and that can work for both `Record` and `RecordClash` because they both have a field `a`. 
    59 With Namespacing this will fail to type check unless the compiler can determine the type of r is either `Record` or `RecordClash`. The advantage of Namespacing is that the implementation is clear, straightforward, and has already been done (in the Frege language, whereas there are still questions as to the feasibility of Overloading). Overloading has seen other downsides in practice. In the words of the Frege author, who abandoned Overloading: 
     61With other approaches (including TDNR) this will fail to type check unless the compiler can determine the type of r is either `Record` or `RecordClash`. 
     62 
     63The advantage of Namespacing is that the implementation is clear, straightforward, and has already been done in Agda and Frege. We can either stop with name-spacing (Agda) or continue on with automatically resolving the field when the dot operator is used. Overloading has seen downsides in practice. In the words of the Frege author, who abandoned Overloading: 
    6064 
    6165    * 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. 
     
    7377One particular way of integrating this idea into Haskell is called  (TDNR). Proposed a couple of years ago, the Haskell community didn't like it much.  (But I still do; SLPJ.) 
    7478 
    75 I believe the community rejected TDNR because they wanted extensible records. I think it is a shame that the debate over *extensible* records has resulted in holding back any form of progress , but I do think that the TDNR proposal seems a little weak for some reasons pointed out in the proposal itself, but also because it proposes not to solve name-spacing record updates. Note that the Frege proposal incorporates the TDNR syntax, and it tackles record updates. -- Greg Weber 
    7679 
    77