[erlang-questions] Type Server

Tim Watson watson.timothy@REDACTED
Fri Mar 2 13:41:28 CET 2012


Thank you Stavros, that sounds perfect. I'll go poke around in dialyzer_contracts and use it as a guide to consuming erl_types. 

Cheers,
Tim

On 2 Mar 2012, at 12:18, Stavros Aronis wrote:

> Hi Tim,
> 
> It would be better in my opinion if you tried to rely only on the erl_types module. erl_types:t_from_form/1 and erl_types:t_is_subtype/2 could possibly be enough for you.
> 
> Dialyzer modules export few of their functions and these usually return the data in a way that is useful to Dialyzer and difficult to see through. You can however follow the code in dialyzer_contracts module, especially dialyzer_contracts:store_tmp_contract/5 and dialyzer_contracts:process_contract_remote_types/1. dialyzer_contracts:store_tmp_contract/5 actually calls erl_types:t_from_form/1 to convert an abstract syntax spec into the representation used in erl_types and after dialyzer_contracts:process_contract_remote_types/1 has done its magic it's very easy to use erl_types:t_is_subtype/2 for the checks that you are describing!
> 
> Cheers,
> Stavros
> 
> 
> On Fri, Mar 2, 2012 at 12:59 PM, Tim Watson <watson.timothy@REDACTED> wrote:
> After poking around in the dialyzer source code a little bit, I think what I'm basically after is being able to run dialyzer_contracts:check_contract/2 independently, without doing a full analysis. I don't care about processing a whole call graph, I'm really just looking to compare two function signatures to figure out if they're compatible. Possibly I'm also interesting in taking one function spec and a set of potentially matching specs and finding the best (most strict?) success typing. Is that something I can do by selectively reusing parts of dialyzer?
> 
> I've poked around in the shell trying to do things like get_top_level_signatures, get_spec_info and things like that, but I can't quite figure out the right entry point to start with. I've even tried a few of the debugging functions such as dialyzer_succ_typings:doit/1 but to no avail.
> 
> Any pointers would be gratefully received! 
> 
> Cheers,
> 
> Tim  
> 
> On 1 Mar 2012, at 21:03, Stavros Aronis wrote:
> 
>> Hi Tim!
>> 
>> I am not sure what you mean by a "type server", as Dialyzer does not really have a "component" that I could imagine being separated and labeled so. Dialyzer has the ability to store the specs and exported types in the PLT and from there use them to increase the precision of the analysis it performs.
>> 
>> What do you mean by "working with types"?
>> 
>> Regards,
>> Stavros
>> 
>> On Thursday, March 1, 2012 4:43:33 PM UTC+1, Tim Watson wrote:
>> Hi all,
>> Both PropEr and Dialyzer appear to have a 'type server' that provides functions for working with type specs. What are the chances of this being available as a separate unit? There is currently very little support for working with types, as the previous post about lack of support in erl_syntax pointed out. It would be nice to see type specs being better supported.
>> 
>> Cheers,
>> 
>> Tim
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>> 
>> 
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120302/25c92abb/attachment.htm>


More information about the erlang-questions mailing list