Jump to content

crelf

Members
  • Posts

    5,759
  • Joined

  • Last visited

  • Days Won

    55

Posts posted by crelf

  1. I can't speak for anyone else, but if I'm trying to change the output of a sub vi based on how (or if) downstream code is using it, that's a pretty good indicator something is wrong with my design.

    I don't agree - for exatly the reason that the original class primative was written this way: it has 2 functions: cast the class, and error out if you can't - using it without caring what the new class is out but only being interested *if* is can be cast is a perfectly valid use case in my opinion. I'm not saying that this is a technique I can think of using often, but it'd be nice to have it in my toolbox.

    If I'm understanding correctly, you just wrap your heavy-lifting code in a case structure that uses the sentinel value as its selector. I think that would be enough for LabVIEW to know what's up.

    Which is the same as I said with a ring selector - which is fine, as long as it's a required input and you you remember to change it.

  2. ...rejected since inlining doesn't prevent a VI from being used with the Call By Reference node. Also, very large VIs should not be inlined, and there's a real probability of people turning on inlining on something big just to get a feature like this...

    Very true - that could certainly mess a bunch of different things up.

    ...could still be better achieved by making it part of the function's signature or making a new type that has sentinel capacity (i.e., a class that has a boolean for "is initialized" and then the rest of the data).

    Please talk about that a little more - your post refers to another post ("as described by mechelecengr above") that doesn't seem to exist any more.

  3. So the answer is "no", because:

    Users have three existing options to solve this problem:

    1) A sentinel value (as described by mechelecengr above)

    2) If all the values in your range are valid values, create a cluster of the u8 and a boolean and use the boolean as the sentinel value.

    3) Create a poly VI that has a junk type (perhaps boolean) on the first implementation listed in the polyVI and and the desired type (u8 in your example) on the other implementation. If the u8 is wired, LV will call the version where it is assumed the input is wired. Otherwise it will call the other, which is written to assume the input is not wired, which may be way more efficient because the runtime system doesn't even have to test anything.

    Your request for this "is wired" property is a feature that I explicitly asked for early in my time in R&D. I learned that it is a bad idea because pretty much any proposed solution that we could do in the LV compiler would be LESS efficient than what a user could code on the diagram. To begin with, the Invoke node itself causes the FP to be loaded into memory in order to have anything to reference. That slows the execution of a subVI considerably right there. More, because we wouldn't know whether a given terminal would necessarily be asked for its "is wired" status, and because there is no block diagram for VIs in the runtime engine, every caller VI would have to compile into itself information about whether or not optional terminals were wired.

    We can do various things like say "this method can only be selected on an implicitly linked Invoke node", which lets us flag callers of subVIs that they need to compile in "wired or not" records into themselves for particular subVI terminals. But that creates problems for Call By Reference nodes since something that had the "this terminal will be tested for 'is wired'" would have a different conpane signature from an otherwise identical conpane that did not test for "is wired".

    In the end, this request is not really supportable by subVIs. Built-in functions can do it because they generate all of their code into the caller VI. Even if we someday have inline subVIs, this would require special code that told LV which portions of a diagram to inline based on whether or not a given terminal was wired -- probably a new structure node or something like that.

    So, short story:

    Yes, this has been contemplated extensively by R&D over the years.

    No, we're not likely to do anything to implement this feature or anything similar to it.

    We have Inline subVIs now :)

  4. Awesome topic! Good to see such a thread where everyone is playing nice and actually debating technology features, not marketing-based emotions :)

    PS: My original thought where why would you buy a tablet when you could have a smart phone? The only IMHO valid retort to that was someone wanted an eReader - and my response was that, if the only valid reason to have a tablet was to read books, then get an eReader - ePaper is simply amazing: I couldn't imagine reading a book on a tablet for a couple of hours verses using an eReader (my wife has a kobo, and it's awesome).

    So I guess I still haven't found a compelling reason to pay for a tablet. Except for

    and this.
  5. Hey Crelf, this Toolkit is great! Far more easier than the standard build in XML toolkit. Not 100% sure about the price, but thanks for the heads up anyway.

    Isn't it neat? I was coding something similar up myself once and got annoyed with how long it was taking to write a generic parser - talked to Jim about how EasyXML works, and BAM! It's one of the most over-looked toolkits, IMHO.

    I either have the tasks built in the project explorer or manually create them in code.

    :thumbup1: Depending on what I'm doing, I prefer to create tasks in my project - then I have something other than a MAX nce file to work with should I need to come back to an old project. It's another feature that a lot of us forget about.

  6. I attempted to reply over on the NI forums, but there's something broken there at the moment, so I'll reply here:

    post-181-0-92682200-1320257213.png

    We've taught the To More Specific node to be aware when its output is unwired and not tell the compiler that it modifies the input object. That means that the first "To More Specific" just does the type testing and never modifies the object even if the cast fails, so the original object remains available for the case structure. The second "To More Specific" actually does the cast.

    That's a super neat thing to know. But it leads me to the quesiton: how can I do that in *my* code? :)

  7. What I would do is create a config file using the standard XML format. This would be originally created from a TypeDef cluster containing all variables (this is also a good idea because it is expandable if required). LabVIEW contains XML subVis which can be used for this config.xml file. Make sure you specify labels for each element in the TypeDef cluster, as they are required in the XML file.

    I agree - and if you're working with XML, you need the JKI EasyXML Toolkit. Seriously. Need. It's awesome. Why are you still reading this post? You should be downloading the EasyXML Toolkit demo. Go do it. Now.

×
×
  • Create New...

Important Information

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