Changes between Version 6 and Version 7 of Records/NameSpacing
 Timestamp:
 Jan 8, 2012 1:17:33 AM (6 years ago)
Legend:
 Unmodified
 Added
 Removed
 Modified

Records/NameSpacing
v6 v7 1 1 See [wiki:Records] for the bigger picture. This is a proposal to solve the records namespacing issue with simple namespacing and simple type resolution. 2 2 3 This approach is an attempt to port the records solution in [http://code.google.com/p/frege/ Frege], a haskelllike language on the JVM. SeeSections 3.2 (primary expressions) and 4.2.1 (Algebraic Data type Declaration  Constructors with labeled fields) of the [http://code.google.com/p/frege/downloads/detail?name=Language202.pdf Frege user manual]3 This approach is an attempt to port the records solution in [http://code.google.com/p/frege/ Frege], a haskelllike language on the JVM. Please read Sections 3.2 (primary expressions) and 4.2.1 (Algebraic Data type Declaration  Constructors with labeled fields) of the [http://code.google.com/p/frege/downloads/detail?name=Language202.pdf Frege user manual] 4 4 5 5 Many thanks to the Frege author, Ingo Wechsung for explaining his implementation and exploring this implementation territory for us. … … 78 78 This is the only real downside of the proposal. The Frege author says: 79 79 80 I estimate that in 2/3 of all cases one does not need to write (T.e x) in sparsely type annotated code, despite the fact that the frege type checker has a left to right bias and does not yet attempt to find the type of x in the code that "follows" the x.e construct (after let unrolling etc.) I think one could do better and guarantee that, if the type of x is inferrable at all, then so will be x.e(Still, it must be more than just a type variable.)80 I estimate that in 2/3 of all cases one does not need to write `T.e x` in sparsely type annotated code, despite the fact that the frege type checker has a left to right bias and does not yet attempt to find the type of `x` in the code that "follows" the `x.e` construct (after let unrolling etc.) I think one could do better and guarantee that, if the type of `x` is inferrable at all, then so will be `x.e` (Still, it must be more than just a type variable.) 81 81 82 82 == Syntax for updates (in the Frege manual) == 83 83 84 * the function that updates field x of data type T is T.{x=}85 * the function that sets field x in a T to 42 is T.{x=42}86 * If a::T then a.{x=} and a.{x=42}are valid87 * the function that changes field x of a T by applying some function to it is T.{x <}84 * the function that updates field `x` of data type `T` is `T.{x=}` 85 * the function that sets field x in a `T` to `42` is `T.{x=42}` 86 * If `a::T` then `a.{x=}` and `a.{x=42}` are valid 87 * the function that changes field x of a T by applying some function to it is `T.{x <}` 88 88 89 89 == Compatibility with existing records ==