Length node output type for spreads has a bug

preview 2022.5-419

ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅

ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅

2022.4.12 working fine

ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅

We can’t really determine what the exact problem is from the screenshots alone, they also show different patches - could you upload a patch showing the issue please?

hmm its weird, I understood

It’s very hard to reproduce

aaand I recreated β€œ<=” node and all start to work perfect
ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅

but I should mention that I decided to write at the forum because I encountered the same problem in third time. Very hard to reproduce, I usually solve it by adding conversion nodes

!:

ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅

Try to help the type inference by

  • double-clicking the <= node and choosing the integer version or
  • double-clicking the Length node and choosing the IHasMemory version

Please keep the original problematic patch and upload here, so that we can tell whether we have to consider it a bug.

@gregsn
I’ve lost that part for the moment, also I’m not sure if it would show up after a restart.
But if I run into it again, I’ll be definitely bringing it here.

As I remember the integer version didn’t want to connect and compare nodes, and everything was in the β€œIHasMemory” version.

on last screenshot β€œ<=” absolutley the same

And again, caught it quicker than I thought


ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅

is reproduced after saving:

_app_gcode.vl (245.9 KB)

switching to the IHasMemory version helps, seems to me.

ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅

Ok I think I understand your confusion. You should use the node Count to get the number for items in a spread and not Length. Length is meant for vectors and such and therefor outputs a float, while Count is meant for collections and should always output an integer.

2 Likes

Thanks! I will only use β€œCount” from now on

But β€œLength” is working!)
So there is ambiguity that cause unpredictable error β€” sometimes working, sometimes not. Or did I misunderstand something?

ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅

ΠΈΠ·ΠΎΠ±Ρ€Π°ΠΆΠ΅Π½ΠΈΠ΅

It feels like at one moment something breaks right inside the node

The Length node is adaptive, our system tries to find an implementation based on the value connected to it. If you place it without connecting it, you’ll see it outputs a Float32. Here we see its original intent, that the input should be some sort of vector. Unfortunately in case of a Spread it finds a β€œfitting” implementation through the IHasMemory interface the spread implements. To make things worse that selected implementation returns an integer and NOT a float, leading to issues you’re experiencing that it seems to behave different from patch to patch.

To address this properly we will need to fine-tune some rules how adaptive candidates are found / matched.

1 Like

Thanks so much for the explanation!

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.