Changes between Version 11 and Version 12 of TypeDirectedNameResolution
- Timestamp:
- 11/19/09 00:53:59 (4 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TypeDirectedNameResolution
v11 v12 197 197 I think this is probably worth it, although it's a little odd. To me, the ability to "stack up" postfix operations is rather important, and the fact that it doesn't fit nicely is the biggest shortcoming of this whole proposal. Can anyone improve it? 198 198 199 == Discussion ==199 == Discussion and other design choices == 200 200 201 201 === Works with any function === … … 286 286 same name. 287 287 288 == Qualified import == 288 === Top-level disambiguation only === 289 290 Consider this 291 {{{ 292 data R = MkR { x,y :: Int } 293 294 f1 :: R -> Int -> R 295 f1 r x = r { x = x } 296 297 }}} 298 Function `f1` is already allowed in Haskell 98; in the update `r {x=x}` the first `x` 299 can only be a field name, while the second binds as usual to the local 300 variable that shadows the top-level name. This is good because it's convenient 301 to use similar names for field names as for local variables. Indeed GHC's support 302 for punning makes this even more attractive. 303 304 But now look at `f2`: 305 {{{ 306 f2 :: R -> Int 307 f2 r x = r.x + x 308 }}} 309 Arguably the same story should apply. Just as the update notation tells which is 310 a field name, the dot notation does the same. So perhaps in TDNR, the `r.x` should 311 choose among '''top-level''' bindings for `x`, ignoring nested ones. 312 313 === Qualified import === 289 314 290 315 Consider this … … 305 330 qualified or not. 306 331 307 == Record syntax == 332 NB: GHC 6.12's existing record field disambiguation makes exactly this choice already. 333 See the [http://www.haskell.org/ghc/dist/current/docs/html/users_guide/syntax-extns.html#disambiguate-fields user manual 7.3.14]. 334 335 === Record syntax === 308 336 309 337 TDNR can apply to record construction and pattern-matching, as indeed
