Changes between Version 34 and Version 35 of Records/NameSpacing


Ignore:
Timestamp:
Jan 18, 2012 3:55:04 AM (2 years ago)
Author:
GregWeber
Comment:

type class interaction

Legend:

Unmodified
Added
Removed
Modified
  • Records/NameSpacing

    v34 v35  
    149149 
    150150In the Frege system, the record's namespace is closed where it is defined. 
    151 However, making a record an instance of a class puts the class functions in the record name-space. 
    152  
    153 {{{ 
    154 module RExtension where 
     151However, making a record an instance of a type class lifts the class functions into the record name-space. 
     152 
     153{{{ 
     154module RecordExtension where 
    155155 
    156156import original.M(R)    -- access the R record defined in module original.M 
     
    162162instance Rextension1 R where 
    163163     -- implementation for new functions 
    164  
    165 And now, in another module one could 
    166  
    167 import RExtension()      -- equivalent to qualified import in Haskell 
    168164}}} 
    169165 
    170166the new functions `f` and `g` are accessible (only) through R. 
    171167So we have a technique for lifting new functions into the Record namespace. 
    172 For the initial records implementaion we definitely want to maintain `f` and `g` at the top-level, but should consider also adding through the record name-space. See related discussion below on future directions. 
     168For the initial records implementaion we would want to maintain `f` and `g` at the top-level, but should consider also adding through the record name-space. See related discussion below on future directions. 
    173169 
    174170== Compatibility with existing records ==