[erlang-questions] PropEr way to deal with recursive types

James Aimonetti james@REDACTED
Sat Sep 10 22:25:23 CEST 2011

Hash: SHA1

On 09/10/2011 06:06 AM, Kostis Sagonas wrote:
> On 09/10/11 14:46, Motiejus Jakštys wrote:
>> On Fri, Sep 09, 2011 at 05:10:30PM -0700, James Aimonetti wrote:
>>> I tried limiting the proplist to 5 tuples, heavily weighting the
>>> proplist_value union towards binary(), etc. When I run
>>> "proper:module(json_tester).", I see a string of periods (varies how far
>>> it gets), then the VM hangs and I have to get into the JCL to interrupt
>>> the process. My assumption is that the generator is getting stuck
>>> creating a big data structure, as CPU and memory increase rapidly.
>>> I've looked at three examples[1][2][3] that Fred Herbert shared but
>>> haven't found the mental bridge between his examples and my attempt. I
>>> don't doubt that I'm misusing or ignorant of the right functions or
>>> macros in PropEr to make this easier.
>>> Any hints? :)
>> You can limit recursion depth as well. Just pass max_size to the
>> proper:quickcheck() function. That helped me as I didn't have to write
>> my own recursive generator. :)
> The PropEr way to deal with recursive types is to delay writing your own
> generators as long as possible. You can start with writing just the
> recursive type definitions and use them as a "for free" generator. If
> that proves not to be adequate for your application, you can try to
> globally limit the recursion depth in the way suggested by Motiejus.
> Only if even that is not enough (for some reason) should you try to
> resort to ?SIZED, resize, ?LAZY, and friends.
> If you encounter any problem at any point in the above we would like to
> hear about it (preferably with a small test that exhibits the problem).
> Please use either the proper@REDACTED address or github for that as not
> all PropEr developers read erlang-questions.
>> As the topic is quite similar, I would like to remind about creating
>> custom types in PropEr.
>> http://erlang.org/pipermail/erlang-questions/2011-August/060619.html
> We are (slowly) working on this one...
> Kostis
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions

Thanks for the replies everyone.

Kostis, I will start over, using your steps above, to generate the test
cases and send the PropEr team code samples if I can't seem to get the
recursive types working.


- -- 
James Aimonetti
Distributed Systems Engineer / DJ MC_

2600hz | http://2600hz.com
tel: 415.886.7905
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/


More information about the erlang-questions mailing list