
On Sat, May 28, 2016 at 3:13 AM, AntC
Evan Laforge
writes: ... what would happen if you tried to do records just like C structs? So e.g. a•b requires 'a' to be a record with a 'b' field, and is just one identifier, no functions involved, and 'b' is not a separate value.
Hi Evan, um, that's the original TDNR isn't it? http://hackage.haskell.org/trac/haskell-prime/wiki/ TypeDirectedNameResolution As per Jeremy's ref in the first post in this thread.
If you're talking C then that blobby thing between a and b should be a dot(?) as postfix operator. And it is an operator, not "just one identifier".
That's why I was trying to emphasize "not an operator". TDNR is complicated is because the field name is a first class value, so it's a function applied to a record, and now we have to disambiguate the function. I didn't meant that. I guess C (and Java and all the others) does call "." an operator because it parses as one and has precedence, but it works with identifiers, not values, and has special grammar. It's not an operator from the haskell point of view. The C compiler isn't doing any overloading or disambiguation. As far as I understand it the implementation is straightforward. Could ghc do something similarly straightforward? It already does for qualified module names, and in the same way in M.a, ".a" is not a function that gets something out of an M.