[eeps] EEP XXX: Pattern-test operator

Richard O'Keefe <>
Mon Apr 23 02:02:38 CEST 2012


On 23/04/2012, at 11:21 AM, Robert Virding wrote:
> - Joe is now considering his structs again and has plans of using a
> syntax like records but without the name.

This basically makes them identical to frames in what they can
represent, and the chief thing added by the frames proposal is
a set of generic functions for manipulating them.

> For example F =
> #{a=1,b="foo"} and perhaps F.a.

Oh dear.  Using the same symbol (=) for two so very different
things does not strike me as a good idea at all.

> This hasn't been finalised but in this form it would free ~ for use.

Joe's syntax used a unary ~, which could have co-existed somewhat
uneasily with an unrelated binary ~.  It is the frames paper which
uses ~ for binding (following Pebble).

> If it is a good choice I don't know yet.

Using ~ for the assignment attempt operator would be a very bad
idea because it is a faux ami.  Anyone who is familiar with AWK
or Perl will expect it to be a REGULAR EXPRESSION pattern match.
Dear knows we could use one.  But it isn't.

I suppose we could live with

	#{ ..., field = Expr, ...}
		% field association

	Pattern ?= Expr
		% assignment attempt

	CharSeq ~ RegExpr
	CharSeq !~ RegExpr
		% regular expression match/non-match

> - If we allowed variable binding in the guard with say Pat = Expr, how
> far would this get us?

A very long way.
> 
> 
> P.S. Something completely different: the non-determinism in CSP is in
> the concurrency isn't?

Chapter 3 of http://www.usingcsp.com/cspbook.pdf
talks about nondeterminism.  There is a nondeterministic choice
operator.

CSP has a fairly clean and well defined semantics, but
the semantics of CSP is defined in terms of traces, and there is
a revealing pair of sentences:

	A trace of the behaviour of a process is a finite sequence
	of symbols recording the events in which the process has
	engaged up to some moment in time.  Imagine there is an
	observer with a notebook who watches the process and
	writes down the name of each event as it occurs.

In a distributed system there need not be a single sequence that
all observers agree on.  I don't know what a "Communicating
Distributed Processes" would use for a semantics.



More information about the eeps mailing list