[Haskell-cafe] Some thoughts on Type-Directed Name Resolution
ok at cs.otago.ac.nz
Tue Feb 7 22:52:41 CET 2012
On 7/02/2012, at 1:41 PM, AntC wrote:
> Richard, now you're just being playful.
"Half fun and full earnest."
I *do* regard 'field OF record' as far more readable, intuitive, &c
than 'record.field'. With the number of meanings '.' already has in
Haskell, I *do* regard any attempt to overload it for field access
as deeply problematic and likely in practice to push much Haskell
code over the readability event horizon.
Anyone who has had occasion to write Fortran in the last 20+ years
has had to discover just how quickly you can get used to using
'record%field'. I'm not really a COBOL programmer, but Prolog and
Erlang and Smalltalk taught me well that '.' in a programming language
can perfectly well mean exactly what it means in English: end of
statement. I just do not buy the idea that the connection between
dot and field access is anything more than a habit of mind engendered
by a few languages or that it should be respected any more than the
habit of using a(i) -- Fortran, Simula 67, Ada, Dijkstra's notation,
PL/I -- or a[i] -- Algol 60, Algol 68, Pascal, C and its horde of
delirious imitators -- for array access.
The idea of using #field for a field access function has of course
an appeal to people familiar with ML or Erlang. The connection with
ML is very close. # is already used. I rather like
field¶ record ([the] field[part] [of] record), with the ¶ Pilcrow
reminding me of Part. Following ML, we could perfectly well allow
3¶ as well, meaning "field 3 of any tuple that _has_ a field 3, the
type to be resolved by context".
More information about the Haskell-Cafe