LabVIEW Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
prettypwnie

By Default, Don't Make Two Auto-Indexing Inputs

Status: New

I propose that if an array is wired into a for loop, the tunnel should be auto-indexing by default (current behavior) UNLESS there is already an auto-indexing input tunnel in that for loop (new behavior).

 

Generally, when I wire an array into a for loop, I want an auto-indexing tunnel, so I am happy that it creates one by default. However, when I wire a second array into the same for loop and it creates another auto-indexing tunnel by default. This is usually not what I want because it will cause the loop to stop early due to one array being smaller. I'm afraid that this default behavior may cause bugs for new programmers because they may not realize to change it (in fact, this has even happened to me before). Default behavior should be the "safe" behavior. Making the decision to have more than one auto-indexing input tunnel in a loop is one that should be carefully considered, so it shouldn't happen by default, but rather should be changed explicitly by the user.

 

I know there have been many ideas posted about the current auto-indexing default behavior, but I didn't see this specific one anywhere, and I think it is an important suggestion.

11 Comments
AristosQueue (NI)
NI Employee (retired)

Speaking for myself personally, if I'm wiring multiple arrays into a loop, it is basically always so I can traverse over both. I wouldn't like this change.

 

Speaking for LV R&D, obviously we could make this change. Let's see how kudos develops. Specifically to you, HopeH, have you observed problems with the current or is this just a hypothetical? I have not observed this being a problem, but I haven't been specifically looking for it.

RavensFan
Knight of NI

I would give this an anti-kudo.  I don't think it would cause the kinds of issues the original poster suggests.  What I would find confusing, certainly if I was a new user, but even as an intermediate or advanced user is that the type of tunnel being created is inconsistent.  I'd be confused if one time I wire something through and it is auto-indexing, and a different time (because of a different auto-indexing tunnel already exists) that the wire is not auto-indexing.

Mads
Active Participant

Anti-kudo from me too. If the first array has no spare dimensions, and the loop happens to contain another loop, there is a higher chance that my intent when wiring a second array into the outer loop is to auto-index that second array through that...but I would rather have a simple and consistent behavior, than one that was making such guesses.

prettypwnie
Active Participant

 

It hasn't happened lately, but when I was a less experienced programmer, I do remember times when I would wire a second array into a for loop and because it was auto-indexing already, I would not be thinking and would start doing things with the individual elements and then later realize that didn't have the same number of elements as the other array and I needed to make another for loop just for that array. Whereas if it wasn't auto-indexing by default, it would have reminded me not to traverse both at once.

 

I feel like making the tunnel auto-indexing is the "guess" and I'd rather it not make guesses if it seems like a bad guess. At least, for me it is more rare that I want both to be auto-indexing, but if that's not the case for others then never mind, I guess. I didn't realize that it was so common for people to want to traverse two arrays at once.

Mads
Active Participant

The automatic auto-indexing is a "guess" too yes, and you could say that not turning on auto-indexing automatically would be the only "correct" thing to do, as you would then opt to not do anything automatically unless 100% sure that it is the intended result.  That would probably add more manual work than it would remove though...(and I kind of like that auto-indexing gets introduced to the newer users too by having it turn on automatically the way it is now).

AristosQueue (NI)
NI Employee (retired)

HopeH: I'll keep my ears open for more on this topic over the next couple years as I visit customers.

Herbert
Member

Anti-kudo from me too.

 

 

gcr3
Member

I like the idea of defaulting the second input as non auto indexing. Yes, you would have to change it to auto indexing if that is your intent, but it means you will have to think about it as your intent, giving you time to think about the implications ("are these the same size? in all cases?", etc). I think of multiple auto-indexed input (and otherwise non-bounded) for loops as overconstrained structures at best. Yes it makes sense that you choose the smaller dimension input as the iteration limit when the dimensions disagree but it seems like a violation of the programmers intent if/when that happens silently. 

wiebe@CARYA
Knight of NI

Could there be some sort of detection? If auto indexing breaks the inside wire (because for example it's wired to an index array), use a non-indexing tunnel?

wiebe@CARYA
Knight of NI

>I like the idea of defaulting the second input as non auto indexing.

 

What is the second input? The top wire or the bottom wire?