-
Notifications
You must be signed in to change notification settings - Fork 226
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
Fix Term's "get_type()" implementation #581
Conversation
Looks like this is not working well on Windows. I'm going to investigate tomorrow. |
Hah, even found out who introduced the bug: #212 🕵️♂️ I can't debug the Windows issue for the next week or so since I won't have a Windows machine available. |
Thanks! I'm trying to setup a Windows VM so I can debug this as well :) |
Just to give an update: I've tested and was able to reproduce the build problem on Windows. |
Yeah, I'll be able to look into it this weekend as well. My initial guess would be a mismatched base type for the enum, Windows |
@philss Did you get any further? I couldn't reproduce it so far, but I'll try again tomorrow. |
@filmor unfortunately I couldn't :/ I tried to figure out where the int type is wrong, but there is no explicit declaration of it. |
d61e4bc
to
2c7fa51
Compare
@filmor I tried a bunch of things to fix this problem with the Windows build, but I couldn't find a solution. I also tried to setup I think, given that we cannot make it work on Windows easily, we could drop this feature for that OS, documenting this behaviour. WDYT? |
Given it never worked, perhaps we should just nuke it altogether. :) |
Well, it works fine on Unix and is IMO the preferable approach (single function call vs. potentially ~10). I'll try to get the Windows interface in line (I think this is mostly about distinguishing floats from integers). /edit: Also, this is clearly a potentially nasty bug (e.g. a type confusion) that I would really like to clear up. |
It is a single function call but internally it is 10 bitmap comparisons. If you want to know if something is a float or integer, asking specifically for float and integer would be more efficient. Also note that nor Erlang nor Elixir have a similar function and we have been just fine for decades. Given it is broken in main, odds are that we really don’t need it. that said, if you can make it work, then that’s great. I am just saying that, if it doesn’t work, it is not the end of the world. :) |
39ba3af
to
65bb94c
Compare
It was not returning the correct type for integers, probably due to a "garbage" arriving because of the wrong type.
65bb94c
to
81e2f30
Compare
@philss @evnu This finally works and passes all tests. It's really not pretty to essentially "copy" this gnarly code for Notes:
|
For what is worth, I don't think we should export a function that does not work on Windows as it may become an additional pitfall for both developers and Windows users. When a package using Rustler misbehaves on Windows, it may lead to both users and authors spent time debugging only to land here. If you really want to go down that route, can it be an opt-in feature? So it is not available by default, reducing the chance of accidental use. Or, make sure that it is not available on Windows (so it is not even compiled) or that it raises a clear error message? |
Which export are you now talking about? What exactly would you make optional here? My intention is to eventually get rid of the custom |
My comment was to make
If it all works on Windows too, then just ignore me. :) But it may be that using |
|
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.
Awesome! For me this is good enough for now 🚢
@filmor thank you for the efforts here!
OTP24 apparently does not correctly recognize remote funs (`fun mod:func/1`) in `is_fun`.
6624826
to
63ec23c
Compare
It was not returning the correct type for integers, probably due to a "garbage" arriving because of the wrong type.
This affects the latest v0.30.