| Author |
Message |
|
| ulf.wiger at etxb.ericsso |
Posted: Tue Apr 27, 1999 10:58 am |
|
|
|
Guest
|
I have a question/discovery that I would like to present:
Every once in a while, the dreaded error message:
{{lambda_clause,mcncServer},{lists,120702597,3}}
appears (mcncServer is just our most recent example.)
This tends to baffle most programmers, and after a few of those, many
try to stay as far away from funs as possible.
Recently, I started looking at the expanded code of a module with funs.
In this particular case, I compiled the mcncServer with
erlc ... -E mcncServer.erl
I started searching for the fun identified by {lists,120702597,3}.
I first tried searching for 120702597, but with no luck.
Then I searched for the string 'fun%3', and found the following:
{ok,PvcKeys,SpvcKeys} ->
Job1 = lists:map(make_fun('fun%2'/1, 2, 92415502, []),PvcKeys),
Job2 = lists:map(make_fun('fun%3'/2, 3, 46622337, []),SpvcKeys),
The funs (1 through 1 are all collected at the end of the file, and
since you can see already from the above that there is something wrong
with 'fun%3' (lists:map/2 expects a fun of arity 1, not 2), I zoomed
down to these two funs:
'fun%2'({Key,ConnType}) ->
sysTimer:apply_after(1000,mcncServer,poll_timeout,
[pvc,Key,ConnType,erlang:self()]),
{pvc,{Key,ConnType}}.
'fun%3'(Key,ConnType) ->
sysTimer:apply_after(1000,mcncServer,poll_timeout,
[spvc,Key,ConnType,erlang:self()]),
{spvc,Key,ConnType}.
I think that this method of identifying funs is unique to BEAM, but I
haven't quite figured out how to read it yet.
- Is the 'lists' reference a way of saying that the fun was called from
the module lists?
- What exactly does 120702597 stand for?
- How is 3 derived in this case? Does it correspond to 'fun%3', or was I
just lucky this time?
Did I just miss the documentation of this, or isn't there any?
/Uffe
--
Ulf Wiger, Chief Designer AXD 301 <ulf.wiger_at_etxb.ericsson.se>
Ericsson Telecom AB tfn: +46 8 719 81 95
Varuv |
|
|
| Back to top |
|
| rv at erix.ericsson.se |
Posted: Wed Apr 28, 1999 10:57 am |
|
|
|
Guest
|
Ulf Wiger <ulf.wiger_at_etxb.ericsson.se> writes:
>I have a question/discovery that I would like to present:
>
>Every once in a while, the dreaded error message:
>
>{{lambda_clause,mcncServer},{lists,120702597,3}}
>
>appears (mcncServer is just our most recent example.)
...
>
>I think that this method of identifying funs is unique to BEAM, but I
>haven't quite figured out how to read it yet.
>
>- Is the 'lists' reference a way of saying that the fun was called from
>the module lists?
>
>- What exactly does 120702597 stand for?
>
>- How is 3 derived in this case? Does it correspond to 'fun%3', or was I
>just lucky this time?
>
>Did I just miss the documentation of this, or isn't there any?
It is not defined and there is no documentation for this. It is
different for the JAM and the BEAM.
In the new version of the BEAM, R6, this will change, as will how fun
errors are signaled. The _current_ suggestion is:
1. Error 'badfun' when something which is not a fun is applied, or the
fun module no longer exists.
2. Error 'badarity' if the fun is applied with the wrong number of
arguments.
3. Error 'function_clause' (!!!) if no clause in the fun matches.
4. The name of the fun "function" will be something like '-foo/3-5-'
meaning that it is the 5th fun in the function foo/3.
N.B. This had not yet been finally decided upon, but it will be
something along these lines. No guarantees.
Two caveats:
1. If this reaches the JAM? I have no idea.
2. When this reaches Open Source? I have no idea, ASAP, but I don't
make the descisions, or do the work. :-)
Robert
--
Robert Virding Tel: +46 (0)8 719 95 28
Computer Science Laboratory Email: rv_at_erix.ericsson.se
Ericsson Telecom AB WWW: http://www.ericsson.se/cslab/~rv
S-126 25 |
|
|
| Back to top |
|
| ulf.wiger at etxb.ericsso |
Posted: Wed Apr 28, 1999 1:17 pm |
|
|
|
Guest
|
Robert Virding wrote:
>
> It is not defined and there is no documentation for this. It is
> different for the JAM and the BEAM.
>
> In the new version of the BEAM, R6, this will change, as will how fun
> errors are signaled. The _current_ suggestion is:
[...]
Ok, that's fine, but I was thinking that it might be useful still for
programmers to know what to do *today* (even if it may change in some
future release.)
Was my analysis of funs in BEAM (today) correct? Is there a
corresponding method that would work for JAM (today)?
/Uffe
--
Ulf Wiger, Chief Designer AXD 301 <ulf.wiger_at_etxb.ericsson.se>
Ericsson Telecom AB tfn: +46 8 719 81 95
Varuv |
|
|
| Back to top |
|
|
|
All times are GMT
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|
|