-
Notifications
You must be signed in to change notification settings - Fork 167
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add ability to limit the number of generated atoms #307
Conversation
0f0de10
to
24523c4
Compare
24523c4
to
cce8715
Compare
Co-authored-by: Jan Uhlig <[email protected]>
cce8715
to
981e455
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure there is something to review at this point: this PR comes with no tests for specifying the atom_limit
option, even with infinity
, so I have zero confidence that the code does anything reasonable when that option is set.
When you do add some tests, you will discover that the code for the non-infinity case cannot run on older Erlang/OTP versions (e.g. 21 and 22 - I believe) because persistent_term
is not available there. So, this code cannot be included as is as long as PropEr still supports these Erlang/OTP versions...
For that case, I suggest we put in a conditional that falls back to always using EDIT: |
OK - so then it's not that bad as I feared. |
I'll retract this PR for the time being. Having tried to make the existing tests work, I realized that it changes the behavior of the current atom generator to a considerable degree, especially when it comes to shrinking, which is currently tightly related to list and integer shrinking. However, as stated in #290 and the follow-up discussion in the Erlang Forums, @juhlig's and my general opinion is that...
For those reasons, it is our opinion that the current way of atom generation is, to put it bluntly, pretty useless, and that it needs to be reconsidered and redesigned. Which is no easy task, because in a realm wherein anything is as good or bad as anything else, what can you reduce to and shrink on? |
As mentioned in #290, the usage of the atom generator (explicit or implicit) can lead to exhaustion of the atom table. While I understand that PropEr does not want to restrict itself to just afew atoms per se, it would be very useful if a user (like me) was given the choice to limit this if needed.