
On 17/11/05, Sebastian Sylvan
On 11/17/05, Greg Woodhouse
wrote: Isn't there a potential for confusion with function composition (f . g)?
That being said, I like this idea (I just need to think it through a bit).
I've been wanting this for ages. It's SO much better than the current horribly broken records we have. There could be confusion with function composition, but there's no ambiguity (compositon have spaces around the dot, while record accessors do not). Personally I think that the dot is way to good of a symbol to be "wasted" on function composition. I mean, how often do you really use function composition in a way which doesn't obfuscate your code? I use ($) way more often than (.). Some people do use it more often than I do, but I find that in most cases except simple "pipelined" functions it only makes the code harder to read. I'd rather function composition was left out of the prelude alltogether (or defined as (#) or something).
Anyway. The current records system is a wart.
Actually, I didn't mention this in the other post, but why not the other way around? Make record selection (#) or (!) (though the latter gets in the way of array access), and leave (.) for function composition. Personally, I'd like something which looked like an arrow for record selection, but most of the good 2-character ones are unavailable. (~>) is a bit hard to type and looks wrong in some fonts. There's a "triangle" which is not taken, and isn't so hard to type (|>). I never really understood the attachment to (.) for record selection. There's no reason that we have to make things look like Java and C. Another option is to make application of a label to a record mean projection, somewhat like things currently are, though since labels aren't really functions anymore that is potentially confusing. - Cale