Changes between Version 16 and Version 17 of Records/NameSpacing


Ignore:
Timestamp:
Jan 9, 2012 7:59:56 AM (3 years ago)
Author:
GregWeber
Comment:

add tuple selectors suggestion

Legend:

Unmodified
Added
Removed
Modified
  • Records/NameSpacing

    v16 v17  
    44Many thanks to the Frege author, Ingo Wechsung for explaining his implementation and exploring this implementation territory for us. 
    55 
    6 The DDC language (again, very much like Haskell, but focused on better and more predictable performance) 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 
     6The 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 
    77 
    88 
     
    118118 
    119119The function update syntax is a new addition to Haskell that we do not need to immediately implement. 
    120 Any thoughts on the Frege field update syntax vs. the current Haskell syntax? 
     120 
     121=== Alternative approach: using tuple selectors === 
     122 
     123{{{ 
     124let { r.x = x'; r.y = y'; r.z = z'; } in r 
     125}}} 
     126 
     127If we allow tuples of selectors: 
     128{{{ 
     129r.(x, y, z) = (r.x, r.y, r.z) 
     130}}} 
     131 
     132then one can simply write 
     133{{{ 
     134let r.(x, y, z) = (x', y', z') in r    
     135}}}              
    121136 
    122137== Interaction with Typeclasses == 
     
    177192}}} 
    178193 
    179 It bothers some that the code does not look like the previous `b a r` - chiefly that the record is now in the middle. Is it possible we can have an equivalent of the dot that changes the ordering? `b a.@r` is possible, but requires an operator that binds to the right. Perhaps a new operator like: `b <. a $ r` 
     194It bothers some that the code does not look like the previous `b a r` - chiefly that the record is now in the middle. Is it possible we can have an equivalent of the dot that changes the ordering? `b a.@r` is possible, but requires an operator that binds to the right. 
     195 
     196=== Partial Application === 
    180197 
    181198Partial application provides a potential solution: `b . .a $ r` 
    182199 
    183 So if we have a function `f r = b r.a` then one can write it points-free: `b . .a`                                                                                                                                                                       
     200So if we have a function `f r = b r.a` then one can write it points-free: `b . .a` 
     201