I just noticed that gweimer/utils/if-else-v isn’t working now that I’ve changed it to use generic pin type. When I try to download utils-example-if-else, it just hangs on Transpiling… Deleting all but the 1st if-else-v block doesn’t seem to make a difference. The other examples still download fine.
Doh…, three more “oops”. Long story short, here’s a working
Your original patch was
not-imlemented-in-xod and we don’t have a system now that projects XOD generics to C++ templates. The system searched for a concrete specialization (
if-else-v(number) in my experiment) and did not find any, so fail to transpile. That’s expected behavior. The bug is that the problem report does not pop up to a clear message.
When you change
not-imlemented-in-xod with a trivial XOD implementation using
if-else, your node is able to work over any type the
if-else supports. And if you take a look at
xod/core you’ll find:
- …more types to come
Will fix them in 0.20.3 very soon
Ah…didn’t think of generics not working with C++. The code just used auto to create vars & code was not type-specific, so I assumed it would work.
Weird. I am getting this error now that if-else-v uses if-else node:
Dead reference error
Patch “xod/core/if-else(number)” is not found in the project
But I can manually add xod/core/if-else(number) to the patch…
Hmm… That’s strange. Are you sure you indeed have no
xod/core/if-else(number)? Take a look in the Project Browser. I mean, maybe you have a
xod/core fork from 0.19.x in your workspace. If the
if-else(number) specialization presents, we have a new problem although all worked when I tried to reproduce. Please, confirm or reject.
Yes, it should be a separate feature. But, but, but. Today @evgenykochetkov came excited to ask:
— Have you seen how gweimer done his
— Yep, it does not work because la-la-la
— It’s a minor bug related to bla-bla. Think wider. Do you understand C++ generics actually work, right now, without any new features?
— Type deduction does la-la, then resolver does foo-bar, then transpiler does baz-qux!…
— Waait… No way. Indeed!
So, generics actually (and surprisingly) should work when implemented in C++ out of the box. There are few silly bugs that stop it from happening. We planed to release 0.20.3 today but ran out of time and will try again at Monday or Tuesday. That, hopefully, will fix everything.
That was the weird part. I was able to search/add node for if-else(number) in the same patch that would not compile because that node was “missing”. I can try again tomorrow when I’m home, but I had already restarted XOD to re-read my library update. There are only downloaded libraries in
XOD\__lib__. Since it is working for you, hopefully it is a fluke I cannot reproduce…
I’m glad my ignorance helped you see an obvious solution for C++ generics
Black magic. I’ve tried to reproduce exactly the same scenario as I see on the screenshot, but get no error. I’m at 0.20.2. Perhaps, the problem is a consequence of a slight variation of actions we perform. Please, would you share a xodball with the problem project as is? Also, confirm that you’re getting the Dead reference error when perform the steps:
- Open the xodball
- Open the
- “Deploy → Upload to Arduino” with “Debug after upload” checked
Thanks for supporting us in the bug hunting session.
gweimer-utils.xodball (85.3 KB)
Those are the steps I follow to get the error. I’ve been opening my copy of the project up to this point, but I opened the library copy this time & got the same error. I’ve tried deleting & re-adding the if-else node, but it hasn’t made a difference.
I just tried deleting my
__lib__/gweimer/utils link & downloading the library; same result. Also same error if I try to compile in the cloud.
Thanks for the xodball!
It is indeed a problem.
The good news is that we already fixed it while implementing a new feature.
The bad news is that it’s not yet released and the bug still happens in 0.20.3. But you can use your original generic
if-else-v implemented in C++
Success! Thank you.
(now I at least 20 chars for valid reply )
This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.