Changes between Version 3 and Version 4 of Records/NameSpacing


Ignore:
Timestamp:
Jan 8, 2012 12:53:28 AM (4 years ago)
Author:
GregWeber
Comment:

formatting

Legend:

Unmodified
Added
Removed
Modified
  • Records/NameSpacing

    v3 v4  
    5151Function bar has no difficulties, after desugaring of the record patterns it's just plain old pattern matching.
    5252
    53 Function foo is also ok, because through the application of r to bar the type checker knows already that r must be an R when it arrives at r.f
     53Function foo is also ok, because through the application of `r` to bar the type checker knows already that r must be an R when it arrives at `r.f`
    5454
    5555Function baz is ok as long as the type checker does not have a left to right bias (Frege currently does have this bias, but will hopefully be improved).
    5656
    57 The last function foobaz gives a type error too, as there is no way to find out the type of r.
     57The last function foobaz gives a type error too, as there is no way to find out the type of `r`.
    5858
    5959Hence, 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:
     
    6868
    6969The record namespace is searched only in 3 cases:
    70  * when some name is explicitly qualifed with R:   R.f
    71  * when the type checker sees x.f and knows that x::R
    72  * In code that lives itself in the namespace R, here even an unqualified f will resolve to R.f (unless, of course, if there is a local binding for f)
     70 * when some name is explicitly qualifed with `R`:   `R.f`
     71 * when the type checker sees `x.f` and knows that `x::R`
     72 * In code that lives itself in the namespace `R`, here even an unqualified `f` will resolve to `R.f` (unless, of course, if there is a local binding for `f`)