LabVIEW Idea Exchange

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

Automatic Coersion Handling wherever possible

Status: Declined

Any idea that has received less than 3 kudos within 3 years after posting will be automatically declined.

It would be nice if LabVIEW handles the coersion automatically by inserting the required conversion function with inserted function in different color or in any other representation wherever possible so that user understands there is a coersion happening and in the same case we will not have performance pitfalls. Example scenario is show in the picture.

 

coersion.jpg

 

If the user still want the coersion, there can be an option of "Forced coersion" in the right click menu of the inserted function.

7 Comments
Mr._Jim
Active Participant

I certainly agree with the motivation behind this suggestion, as I am pretty much paranoid about coercion dots.  However, I'm generally not a big fan of "auto" or "express" anything except maybe the auto tool selection.  I do, however, love having convenient options.

 

What if this was a context menu option?  There could be a direct link to the "Conversion" palette under the "Insert" menu:

ConversionContextMenu.png

Or the insert menu could directly refer to the proper conversion function:

DBLConversionContextMenu.png

Dragis
Active Participant

i like the overall idea, but i don't think it should always happen automatically; for instance, there are many times i wire an indicator with a different value only to immediately change the type of the indicator to match the type of the wire. i'd be fine with a special mouse mode (via a keyboard modification) or with jim's idea of a fast menu option.

JackDunaway
Trusted Enthusiast

@Nandagopal wrote:

It would be nice if LabVIEW handles the coersion automatically...so...we will not have performance pitfalls.


Assuming explicit coercion is faster than implicit coercion is just an assumption. This snippet shows that implicit coercion outperforms explicit coercion by about 11% on my machine. 

 

So, it might be better to keep the little red buggers around! Smiley Surprised Do I agree with this behavior? Not necessarily, but I think it's important to air misconceptions about coercion dots and ensure they are mitigated properly (where, sometimes, the proper mitigation technique is to let them remain).

 

(I originally learned this from the community's efficiency guru)

  

ExplicitVersusImplicitCoercion.png

JackDunaway
Trusted Enthusiast

A better link (which was a product of the above link I posted) goes into more detail about Dealing with Coercion Dots.

 

A good quote from there:

 

"Mindlessly throwing in a conversion operation is just covering things up with a bandaid. It's not solving the problem, but just deals with the problem more explicitely. The data still needs to be converted and possibly a new buffer allocated. You don't gain much! Of course if the wire branches to several coercion dots, converting once possibly makes sense.

 

The correct way to deal with coercion dots is deciding on a better representation for the data from the ground up an solve things upstream. Change the representation of the control itself! Rewrite the subVI to give the correct output repesentation! Whatever is most logical."

Mr._Jim
Active Participant

"Out, d@mn'd spot!"

 

Very interesting, Jack...  It looks like we should individually take the initiative to become LabVIEW mythbusters more often!  This is a case that demonstrates how we should continually re-evaluate old habits for their validity.

 

My aversion to coercion dots goes back to a certain school of LabVIEW style that I'll leave unnamed.

 

It seems strangely unjust that explicit coercion often results in less efficient code...  (:smileysurprised:, indeed!)  I guess we shouldn't be surprised, though.

 

...but we digress.

 

I still think the menu option would be nice.

tst
Knight of NI Knight of NI
Knight of NI

> ...What if this was a context menu option?

 

 

If you want this now, you can use this RCF plugin:

 

http://lavag.org/files/file/85-insert-type-conversion-rcf-plugin-v1207/


___________________
Try to take over the world!
Darren
Proven Zealot
Status changed to: Declined

Any idea that has received less than 3 kudos within 3 years after posting will be automatically declined.