Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[Caml-list] suggestion for record pattern matching and construction
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2003-09-10 (18:54)
From: Eric C. Cooper <ecc@c...>
Subject: [Caml-list] suggestion for record pattern matching and construction
I find that I am often writing code like
    { field1 = field1; field2 = field2; field3 = field3 }
when matching and constructing records.  I guess it's because thinking
up good names for the record fields is nontrivial and having similar
but different names for the bindings just bothers me.

How about allowing syntax like that used for labels:
    { ~field1; ~field2; ~field3 }
would expand into the above, in both pattern matching and construction

This is orthogonal to (and I think much simpler than) omitting some
fields via "..." notation.

Eric C. Cooper          e c c @ c m u . e d u

To unsubscribe, mail Archives:
Bug reports: FAQ:
Beginner's list: