Jump to content
Tomi Maila

Type parameters

Recommended Posts

39 minutes ago, ned said:

For example, generics allow you to write a sorting algorithm that takes a list, and a comparison function that operates on elements of that list. The compiler verifies that the comparison function matches the list element type, so you can't have a run-time type mismatch.

This can be done in a VIM because the comparison primitives' adapt to type so all that is needed is for the controls and indicators on the VI to do the same. Do you have another example?

 

2 hours ago, Tomi Maila said:

ShaunR, the List type in your example is not strongly typed but generic. That means the type of the list wire for a list of Strings is not different from the type of the list wire for the list of DBLs. That's the exact problem type parameters would solve. 

That's because variants are run-time evaluated even though we have to stipulate how to deference them with the Variant To Data primitive.

Wouldn't a "To Variant" that could be configured much the same way control refs have the option to "Include Data" to make them "Strict" be more intuitive and easier? After all. Variants do contain the type already, it just doesn't get propagated at design time. The bonus would be we wouldn't need the "Variant To Data" 99% of the time at all.

Edited by ShaunR

Share this post


Link to post
Share on other sites
On 3/14/2017 at 1:26 PM, ned said:

 Right now you can't do this in LabVIEW.

Welcome to LabVIEW 2017. It'll be even better in 2017 SP1, but this works for now.

Untitled.png

  • Like 2

Share this post


Link to post
Share on other sites

Nice! Does it mean that in the background LVOOP started supporting multiple inheritance and one day it will become available to us all?

Share this post


Link to post
Share on other sites
13 hours ago, 0_o said:

Nice! Does it mean that in the background LVOOP started supporting multiple inheritance and one day it will become available to us all?

What? There's nothing about OO in the picture I posted.

Share this post


Link to post
Share on other sites

I understand. Any chance LV NXG will support multiple inheritance?

Share this post


Link to post
Share on other sites
On 6/7/2017 at 4:14 AM, 0_o said:

I understand. Any chance LV NXG will support multiple inheritance?

None whatsoever while I'm working here.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.