[erlang-questions] Extracting detailed information from TypEr/Dialyzer
Wed Nov 3 10:20:35 CET 2010
I don't know how immediately useful this is (perhaps something to keep in
mind), but one of the attractive understated things about UBF is that you
define all this information in one place for both easy
configuration/protocol-definition and reading/self-documentation...
So far, I haven't regretted switching from gen_fsm to UBF(C)
- Edmond -
On Mon, 01 Nov 2010 05:58:35 +1100, Tomas Abrahamsson
> On Tue, Oct 12, 2010 at 09:00, Torben Hoffmann <>
>> I want to extract the following information from a gen_fsm:
>> - all the states
>> - the incoming events
>> - possible next states
>> but I want to do it per function clause and not only on the function
>> as TypEr and Dialyzer does it.
> One way to do that is to copy each function clause into a
> separate function. Then one can run TypEr on the expanded
> code. Attached is an escript that does such an expansion
> of exported functions of arity 2 and 3, and also of
> handle_event, handle_sync_event and handle_info. The script
> accepts -I and -D options for include paths and macro
> definitions, just like erlc,and prints the expanded program
> on stdout.
> I've tried plotting state machines from the output of TypEr
> when run on the expanded results, and it seems to do reasonably
> well. I haven't done any thorough verification.
> It doesn't solve all of your problems: it doesn't find any
> outgoing messages, and it has the same limitations you
> already indicated when returning from a function clause in
> different ways, so I guess the results are roughly what
> you already seems to have, or what Vance's drawing tool
> already produces.
> Somehow being able to make more use of TypEr's
> knowledge about a file would be really interesting,
> for example to be able to query it for type information
> given various execution paths through the program,
> if it would be possible.
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
More information about the erlang-questions