[Ur] Using a simpler "flexible record pattern" - still getting syntax errors

Stefan Scott Alexander stefanscottalexx at gmail.com
Mon Jul 27 15:57:52 EDT 2015


Thank you Adam for pointing out the errors in my previous attempts doing
pattern-matching on a record.

As a test, I'm now trying a very simple pattern as follows:

  fun getSomeColNam someCols =
    case someCols of
        { colNam = _ , ... } => colNam
      | _ => error

I'm still getting syntax errors:

  syntax error: replacing  OF with  LPAREN
  Field name not constant in pattern

The syntax errors always start at the position of the keyword `of` - but I
assume the error could be elsewhere (later) in the pattern.

I'm trying to follow the syntax for the "flexible record pattern" from page
14 of the manual:

  {(x = p,)+, ... }            flexible record pattern

I can't find the error in my syntax.

---------

Observation:

Assuming that fields are un-ordered, the above example may not only be very
*simple* - it might also be *non-deterministic*, as it seems like it could
match an *arbitrary* field name.

This apparent non-determinism might be somehow related to the error itself
in the above syntax.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20150727/33d7cbcf/attachment.html>


More information about the Ur mailing list