non-Erlang Erlang grammars

Vlad Dumitrescu <>
Tue Oct 24 08:59:02 CEST 2000


----- Original Message -----
From: "Robert Virding" <>
Ulf Wiger <> 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.
---------

I was thinking about this problem, and I suppose the solution using funs
would be to provide an ets:lookup/3, where the third argument is a fun that
filters the results of ets:lookup/2 and also filters the elements that will
be outputted to the result. Also, list comprehensions that accept an ets
generator would also do fine, even more elegantly than simple funs.

As I understand it, the big problem is how to make the funs evaluate in ets
space, not local space. But otherwise I can't understand why these funs
should abide by the following rules
>- no message passing
>- no external function calls
>- no loops
>- no operations that are not known to be O(1)

Is it an efficiency aspect? Or an implementation issue? Or a more deep-going
architecture one?
Is it because the funs woill be evaluated in a different space?
Could someone please explain this? Thanks.

Vlad



More information about the erlang-questions mailing list