Changes between Version 41 and Version 42 of Records


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

downside of polymorphic record fields

Legend:

Unmodified
Added
Removed
Modified
  • Records

    v41 v42  
    5858}}} 
    5959 
    60 and that can work for both `Record` and `RecordClash` because they both have a field `a`. 
    61 With other approaches (including TDNR) this will fail to type check unless the compiler can determine the type of r is either `Record` or `RecordClash`. 
     60and that can work for both `Record` and `RecordClash` if they are defined in the same module because they both have a field `a`. 
     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`. Note that we already can accomplish this on an opt-in basis with Type Classes: making this automatic is not required and could give the unwary user weakly-typed code. 
    6262 
    6363The 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: