Changes between Version 3 and Version 4 of Records/NameSpacing
- Timestamp:
- 01/07/12 16:53:28 (17 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Records/NameSpacing
v3 v4 51 51 Function bar has no difficulties, after desugaring of the record patterns it's just plain old pattern matching. 52 52 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.f53 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` 54 54 55 55 Function 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). 56 56 57 The last function foobaz gives a type error too, as there is no way to find out the type of r.57 The last function foobaz gives a type error too, as there is no way to find out the type of `r`. 58 58 59 59 Hence, 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: … … 68 68 69 69 The record namespace is searched only in 3 cases: 70 * when some name is explicitly qualifed with R: R.f71 * when the type checker sees x.f and knows that x::R72 * 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`)
