Changes between Version 12 and Version 13 of Records/NameSpacing


Ignore:
Timestamp:
Jan 8, 2012 1:20:13 PM (2 years ago)
Author:
GregWeber
Comment:

dot operator

Legend:

Unmodified
Added
Removed
Modified
  • Records/NameSpacing

    v12 v13  
    22 
    33This 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] 
     4Many thanks to the Frege author, Ingo Wechsung for explaining his implementation and exploring this implementation territory for us. 
    45 
    5 Many thanks to the Frege author, Ingo Wechsung for explaining his implementation and exploring this implementation territory for us. 
     6The DDC language (again, very much like Haskell, but focused on better performance and predictability) 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 
    67 
    78== Better name spacing == 
     
    3738 Rather than strictly re-use modules it may make more sense to have a name-spacing implementation construct that is shared between both records and modules - hopefully this would make implementation easier and unify behavior. In the Frege approach, each data declaration is its own namespace - if we were to go this far (instead of stopping purely at records) there may be much less need for local namespaces. Overall this seems to be more of an interesting implementation detail than a concrete design proposal relating to records. -- Greg Weber. 
    3839 
    39 == Getting rid of the Verbosity == 
     40== Getting rid of the Verbosity with the dot operator == 
    4041 
    4142We have name-spaces, but the equivalent is already being accomplished by adding prefixes to record fields: `data Record = Record { recordA :: String }` 
     
    4344Verbosity is solved in Frege by using the TDNR syntax concept. In `data Record = Record {a::String};r = Record "A"; r.a` The final `r.a` resolves to `Record.a r`. 
    4445See below for how we resolve the type of this code. 
     46 
     47=== Specifics on the dot === 
     48 
     49This proposal requires the current Haskell function composition dot operator to have spaces (at least on the left side). No spaces around the dot are reserved for name-spacing: this use and the current module namespace use. The dot operator should bind as tightly as possible. 
    4550 
    4651== Simple type resolution ==