-
Notifications
You must be signed in to change notification settings - Fork 392
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
Use unsized, typeless, tuple to fix OTP 18 compilation #745
Conversation
This patch fixes compilation for OTP 18. There's currently no method of specifying a tuple of arbitrary size of type T.
👍 please merge this, making it harder to use riak_core on latest ubuntu with erlang 18 by default. |
👎 Wouldn't it be better to introduce an actual type for this tuple and what it contains? From what I can tell, you've weakened the type such that Dialyzer will be less effective in determining the proper type -- this isn't just a tuple, it's a tuple containing something. |
How are you going to do that? There is, to my knowledge, no way to specify a tuple of arbitrary size of type T. The code is based around the idea that you (ab)use tuples to create O(1) lookup tables. See: Fixing the implementation is a much harder issue, but until then the code is simply broken - not just broken in the "it could be nicer" kind of broken, but the "s*** doesn't compile" kind of broken. |
As far as I read the source code, the |
Changing the tuple to a map sounds fine re getting cleaner code and better help for Dialyzer. However, there are many Riak installations on R16, so changing to a map() would make it harder to maintain one code branch. And then we have the issue of the code being written with some performance goals in mind. |
if I include a switch on the version maintaining the current type for < R18 and the new one for >= R18 will it be accepted? if not, is there a proposed solution? as is, riak_core doesn't compile on R18. |
Were I to make the call, I'd just take the patch. I'm weary about the dialyzer being able to do anything sensible (check with typer what it infers). |
Having looked a bit deeper into the code I agree with @jlouis since the nodes field is only used inside the chashbin module and it is limited what Dialyzer can get out of that. Accepting this will enable us to keep the code the same without any version magic. |
Use unsized, typeless, tuple to fix OTP 18 compilation
Double-checked inside Basho and the patch is fine. |
Thanks. |
Awesome work @ahf! If you find the time, come hang out with us at RICON this year. 👌 Thanks for merging @lehoff. |
This patch fixes compilation for OTP 18.
There's currently no method of specifying a tuple of arbitrary size of type T.