LabVIEW Idea Exchange

About LabVIEW Idea Exchange

Have a LabVIEW Idea?

  1. Browse by label or search in the LabVIEW Idea Exchange to see if your idea has previously been submitted. If your idea exists be sure to vote for the idea by giving it kudos to indicate your approval!
  2. If your idea has not been submitted click Post New Idea to submit a product idea to the LabVIEW Idea Exchange. Be sure to submit a separate post for each idea.
  3. Watch as the community gives your idea kudos and adds their input.
  4. As NI R&D considers the idea, they will change the idea status.
  5. Give kudos to other ideas that you would like to see in a future version of LabVIEW!
Top Authors
cancel
Showing results for 
Search instead for 
Did you mean: 
somebody_that_i_used_to_k

Allow References to be Wired into Case Selectors to Check for Validity

Status: Declined

I propose that Case Selectors should accept any type of reference, and the two cases generated are "Valid Ref" and "Invalid Ref". (This would be very similar to the current behavior of the Case Selector accepting errors with the two cases of "Error" and "No Error".)

 

The current behavior using "Not a Number/Path/Refnum" is very unintuitive. It requires the programmer to use Not Logic (i.e., do something if the reference is "not not valid").

 

ReferencesIntoCaseSelectors.png

 

 

Wirebird Labs: Expert Toolkits for LabVIEWDeploy, by Wirebird Labs: Expert Toolkits for LabVIEW
17 Comments
RavensFan
Knight of NI

I really am surprised this idea has so many kudoes.  It sounds nice, but is it really necessary considering the current situation is just the use of a Not a Ref function which already exists?

 

Select class based on Refnum could be a much more useful idea and I would rather see that implemented over this.

somebody_that_i_used_to_k
Trusted Enthusiast

@tst wrote:

 If the two are mutually exclusive then the other idea is definitely more valuable.


 Totally agreed!

Wirebird Labs: Expert Toolkits for LabVIEWDeploy, by Wirebird Labs: Expert Toolkits for LabVIEW
PhillipBrooks
Active Participant

Interesting. I commented on this LAVA post today, then happened across this suggestion. Aristos makes an important observation about misusing the "Not A Refnum" primative that can create a race condition in your application.

 

http://lavag.org/topic/15546-are-you-misusing-the-not-a-refnum-function-and-putting-your-app-at-risk...

 

How might this idea be affected by this observation?


Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.

"You are what you don't automate"
Inplaceness is synonymous with insidiousness

Daklu
Active Participant

There are lots of LV power users who have kudoed this idea.  I'll risk the tar and feathers and say no, this is not a good idea.  I posted my response on LAVA before I saw Phillip had linked to this idea, so I'll just summarize my argument here for those that don't want to read through the entire LAVA thread.

 

Pretesting a reference before performing an operation on that reference is a race condition and should be discouraged.  It's not just the Not A Refnum function, it's any sort of pretesting used to make execution branching decisions.  Your users may never encounter the race condition, but it is there.  If you're operating on a reference, attempt the operation then do a postcheck for errors.

somebody_that_i_used_to_k
Trusted Enthusiast

I have a tendency to agree that this idea could promote "seemingly safe" but actually bad practices, and after AQ's warning in 2009, I actually came to realize this is probably not a good feature to add to the language. Granted, it would be acceptable and syntactically slick to execute code in the <Not a Refnum> case, but the tendency for developers to place code in the <Valid Refnum> case makes it dangerous (even my snippet to promote this Idea makes this mistake!).

 

I respectfully suggest this Idea be Rejected on the grounds of potentially causing more problems than the syntactical sugar is worth (and also because it complicates the case selection of class types, a much cooler and more useful Idea)

Wirebird Labs: Expert Toolkits for LabVIEWDeploy, by Wirebird Labs: Expert Toolkits for LabVIEW
X.
Trusted Enthusiast
Trusted Enthusiast

So how can we kudo the suggestion of removing the suggestion? When will we get "like/dislike" options? Has this been patented by Facebook and Google?

MaryH
Community Team
Status changed to: Declined