non-Erlang Erlang grammars

Robert Virding rv@REDACTED
Mon Oct 23 15:12:19 CEST 2000


Ulf Wiger <etxuwig@REDACTED> writes:
>
>I've spent some time pondering the match specifications for trace
>and (not yet released) ets. While the functionality is powerful
>and much wanted, I think it's really too bad that one can't specify
>the filters using Erlang pattern matching syntax, which is already so
>familiar.
>

One thing I thought might be a good way to solve this this problem 
would be to use funs, BUT be extremely restrictive in what is allowed 
within the fun, basically matching and simple BIFs.  No function calls 
at all or data creation either.

This checking could be done at run time so no extra langauge constructs 
or definitions are necessary.

What it can't do is allow you to construct match specifications on the 
fly.

The problem with all this is of course that as an ets table doesn't 
exist within any process there is no context in which to evaluate the 
fun.  Therefore you have to be extremely restrictive.  With a bit of 
trickery you could probably allow calls to local functions as long as 
they obey the ame restricitive rules.  To handle recursion just allow 
at most one time slice per check, anything longer results in a fail, or 
error.

While this operationally might not give you more than match specs it at 
least uses existing features in a relatively clean way.  And I agree, 
match specs are ugly.

	Robert

-- 
Robert Virding                          Tel: +46 (0)8 545 55 017
Alteon Web Systems                      Email: rv@REDACTED
S:t Eriksgatan 44                       WWW: http://www.bluetail.com/~rv
SE-112 34 Stockholm, SWEDEN
"Folk säger att jag inte bryr mig om någonting, men det skiter jag i".





More information about the erlang-questions mailing list