Bools as 32-bit Integers


#1

I'm wondering what the logic is behind using signed 32-bit integers instead of boolean variables inside objects.
I notice the gate/logic input and outputs are also 32-bit, which seems odd to me.

I've been using bools variables to store on/off states in my objects, and they seem to work fine, but I'm wondering if I should be using ints instead.

a|x


#2

There is no logic behind, and I consider changing them to bools.

No, it's good practice to use bools.


#3

Oh, good to know!

Does that mean you will change the inlet/outlet types, too? Maybe there's no need, since translation between bools and int32 bool in/outlet seems to work transparently.

a|x


#4

Yes.

This 'd prevent ambiguous behavior by objects that depend on the actual value like noticed here: https://sebiik.github.io/community.axoloti.com.backup/t/problem-with-flipflop-toggle-object/1768
in other cases I do not expect any functional impact from this change, still I need to verify carefully before making this change.


#5

Yep, I noticed some of the Library objects I've been looking at use numeric comparisons on bools, which may be broken if in/outlet types are changed to true bools.

a|x


#6

aha, just commented on that in the thread
1 bit bools makes more sense
and then my original example will work :smile: