Version française
Home     About     Download     Resources     Contact us    
Browse thread
RE: stream pattern [< pat=exp >] and extensions to ordinary patte rn m atching
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Manuel Fahndrich <maf@m...>
Subject: RE: stream pattern [< pat=exp >] and extensions to ordinary patte rn m atching

I have to reply to my own earlier (faulty) comments...

  [...]
  I believe that with such an extension to
  OCAML, the pattern language we explored in the ICFP paper could be
expressed
  completely (and more).
  [...]

This is not entirely true. The pattern language explored in the ICFP paper
allows one to write non-deterministic patterns that get influenced by the
context. For example:

	pat leftOrRight(x) =
            (x, _)
          | (_, x)

If I then write

	match (1,2) with

        leftOrRight(2) ->
      | leftOrRight(y) ->

the first clause would apply. Using the pat=exp approach from stream
parsers, such choices in function of pat would not be possible. I consider
this feature not essential, and having pat=exp patterns whose semantics
evaluate exp first without regard to pat would still be very useful. 


-Manuel Fahndrich