Changes between Version 2 and Version 3 of Records/NameSpacing


Ignore:
Timestamp:
Jan 8, 2012 12:52:18 AM (2 years ago)
Author:
GregWeber
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • Records/NameSpacing

    v2 v3  
    3737For example, lets say we have: 
    3838 
     39{{{ 
    3940data R = R { f :: Int } 
    4041 
     
    4647 
    4748foobaz r = r.f 
     49}}} 
    4850 
    4951Function bar has no difficulties, after desugaring of the record patterns it's just plain old pattern matching. 
     
    5759Hence, the records in Frege are a very conservative extension to plain old algebraic data types, actually all record constructs will be desugared and reduced to non-record form in the way I have described in the language reference. For example, the data R above will become: 
    5860 
     61{{{ 
    5962data R = R Int where 
    6063    f (R x) = x 
    6164    ... 
     65}}} 
    6266 
    6367To be sure, the where clause is the crucial point here. It puts f in the name space R. The global scope is not affected, there is nothing named f outside the R namespace.