Changes between Version 48 and Version 49 of Records/NameSpacing
- Timestamp:
- 02/22/12 16:34:32 (15 months ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Records/NameSpacing
v48 v49 1 1 See [wiki:Records] for the bigger picture. This is a proposal to solve the records name-spacing issue with name-spacing and how to expand on that to make record access more convenient. 2 2 3 This approach is an attempt to port the records solution in [http://code.google.com/p/frege/ Frege], a haskell-like 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=Language-411.pdf Frege user manual] 3 This approach is an attempt to port the records solution in [http://code.google.com/p/frege/ Frege], a haskell-like language on the JVM. We can stop half-way to Frege and instead implement the Agda module-only solution - this is explained below. 4 5 For information on Frege, 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=Language-411.pdf Frege user manual] 4 6 Many thanks to the Frege author, Ingo Wechsung for explaining his implementation and exploring this implementation territory for us. 5 6 The DDC language (again, very much like Haskell, but focused on effect tracking and an overall different conceptual approach to purity) puts forth a similar solution. See the [http://www.cse.unsw.edu.au/~benl/papers/thesis/lippmeier-impure-world.pdf thesis] section 2.7 - 2.7.4 pages 115 - 119 7 8 The Opa language (functional, focused on web development) states that its modules are a special case of records. 7 The DDC language (very similar to Haskell) puts forth a similar solution to Frege. See the [http://www.cse.unsw.edu.au/~benl/papers/thesis/lippmeier-impure-world.pdf thesis] section 2.7 - 2.7.4 pages 115 - 119 9 8 10 9 The Agda language [http://wiki.portal.chalmers.se/agda/pmwiki.php?n=ReferenceManual.Records generates a module (name space) for each record and also allows a record, like any module to be placed into the global scope by the programmer (opened in Agada terms)]. 11 12 Other FP languages where I looked for a record implementation but it appeared they have no solution for records with the same fields (my information could be wrong/out-dated) ocaml, oz. However, the O in OCaml is for objects, and objects have structural typing that supports abstraction over fields.13 14 I couldn't find great specific information on record implementation ML variants. Best I can tell, SML does not allow records in the same module with the same field. Records from other modules require name-spacing or must be opened up similar to Agda. SML# supports [http://www.pllab.riec.tohoku.ac.jp/smlsharp/?FeatureRecordPolymorphism abstraction over fields] as per the overloaded records implementation.15 16 [http://roy.brianmckenna.org/ Roy], a functional language that targets javascript, also has structural typing which prevents clashes and allows abstraction over fields.17 10 18 11 == Better name spacing ==
