Browse thread
RE: [Caml-list] Record pattern matching
- Don Syme
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Don Syme <dsyme@m...> |
| Subject: | RE: [Caml-list] Record pattern matching |
> > I guess this is considered a feature, but I just wanted to report
that
> > in my current situation I actually find it unhelpful.
>
> You'd rather be forced to code something like:
>
> function { a=a; b=_ } -> a;;
>
> where all the fields have to be named, but some of them can
> be specified as ignored?
I guess the point is that I don't use record pattern matching much, and
where I do I don't want partial matches. Or at least I have a cases
where enforcing full matching would catch more bugs. For example, if
I'm writing marshalling code for the record by hand I want the type
system to tell me if I have forgotten to marshal a field.
> There is a sense in which
>
> record.a
>
> is just a shorthand for
>
> match record with { a=value } -> value
>
> which means that you might argue that the notation
>
> record.a
>
> should be completed by naming every field too :-)
You could argue that, but I wouldn't....
Don
-------------------
To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr