Jump to content

True/False constants and other philosophical questions...


Recommended Posts

Why does the Boolean palette include both a True constant and a False constant?

Why does a numeric constant in the BD default to I32, while a control/indicator on the FP defaults to a double?

Thank you to whomever changed the Compound Arithmetic so that it defaults to a logical operation when selected from the Boolean palette, and an arithmetic operation when selected from the Numeric palette.

Link to comment

QUOTE (Gary Rubin @ May 7 2009, 01:09 PM)

Why does the Boolean palette include both a True constant and a False constant?

Why does a numeric constant in the BD default to I32, while a control/indicator on the FP defaults to a double?

Thank you to whomever changed the Compound Arithmetic so that it defaults to a logical operation when selected from the Boolean palette, and an arithmetic operation when selected from the Numeric palette.

Amen to that!

Other subtle changes that I apreciate include;

When we wire a error cluster to a case it puts the code in the No Error Case

When we create an sub-VI with an error cluster the error in is optional while all other inputs are required.

Insert node on a reference wires to the refence input instead of the error cluster...

These have all mde my life easier.

RE: Why both True and False?

I can only guess that in version 1 of LV you could not click on a constant and change it.

Re: Philosophical...

Before LV will be able to realize true artificial intelegnce, we will need a "Maybe Gate".

Ben

Link to comment

QUOTE (Gary Rubin @ May 7 2009, 10:09 AM)

I remember changing the constant in front of someone who had used LV for several years, and he exclaimed ,"I never knew you could do that! I always put a NOT function after it." Maybe he wasn't the sharpest tool in the shed, but I'll wager he wasn't alone, so NI put both of them in the palette (in the old days there was only the False constant).

QUOTE (neBulus @ May 7 2009, 10:30 AM)

When we wire a error cluster to a case it puts the code in the No Error Case

When we create an sub-VI with an error cluster the error in is optional while all other inputs are required.

Insert node on a reference wires to the refence input instead of the error cluster...

I thought these all got fixed from earlier versions when they were much more annoying, but I would agree, the changes were welcome.

I wish that when replacing Multiply (for example) with Compound Arithmetic, then the multiply option would automatically be chosen.

I also wish that when using Create SubVI... that the Error In and Error Out terminals would be named correctly.

I wish there was a simpler Array Size primitive that just resized itself for the number of dimensions.

I wish there was a simple PlusAndMinus primitive with two inputs and two outputs.

I wish that Merge Errors.vi was a resizable primitive.

Link to comment

QUOTE (jdunham @ May 7 2009, 02:04 PM)

I remember changing the constant in front of someone who had used LV for several years, and he exclaimed ,"I never knew you could do that! I always put a NOT function after it." Maybe he wasn't the sharpest tool in the shed, but I'll wager he wasn't alone, so NI put both of them in the palette (in the old days there was only the False constant).

So, originally you could only define a FALSE constant? There was no True? :wacko:

Link to comment

QUOTE (Gary Rubin @ May 7 2009, 11:08 AM)

So, originally you could only define a FALSE constant? There was no True? :wacko:

No, you could change it with the Operate tool. But I guess that was non-obvious enough that it was easier to add a TRUE version to the palette than to try to educate people.

Link to comment

QUOTE (PaulG. @ May 7 2009, 01:13 PM)

Because the i terminal returns the number of iterations that are completed, and the i terminal returns its value during the current iteration. If you want the iteration count after the loop runs, wire the output of the N terminal, not the i terminal.

QUOTE (Gary Rubin @ May 7 2009, 12:09 PM)

Why does a numeric constant in the BD default to I32, while a control/indicator on the FP defaults to a double?

Because most people want double type for the numeric. But it is really nice on the BD constant to drop it and then, if you need floating point, to type in a value using a decimal point and the constant will automatically change to double type. If it dropped as double by default, if you typed 3, we wouldn't be able to assume that meant you wanted an integer.

We'd probably do the same thing on the FP except that most people never type into the thing that drops onto the FP... they just leave the value as zero (and you wouldn't want it coercing to a new type everytime you typed a value into it while you were debugging!).

Link to comment

QUOTE (jdunham @ May 7 2009, 08:04 PM)

...in the old days there was only the False constant.

It reminded me old russian joke: The beginning of the russian Bible edition: At the beginning there was nothing. Only Comrade God was walking around the streets of Moscow.

However it sounds best in russian...

QUOTE

But it is really nice on the BD constant to drop it and then, if you need floating point, to type in a value using a decimal point and the constant will automatically change to double type.

I don't belive! It's the first thing I'll check tomorrow!

Link to comment

QUOTE (Aristos Queue @ May 7 2009, 03:16 PM)

But it is really nice on the BD constant to drop it and then, if you need floating point, to type in a value using a decimal point and the constant will automatically change to double type.

Tell Darren you found him a nugget for this coming week! This is kind of cool!

Link to comment

QUOTE (Neville D @ May 7 2009, 12:19 PM)

Thanks, I knew about that. But what I really want is this... (And I've already suggested it to NI, but you never hear back about that kind of thing).

post-1764-1241729121.png?width=400

This construction comes up all the time if you use picture controls, or you do GUI arrangements, any kind of 2D coordinate stuff, or histogram bins, or limit testing... I know it sounds like feature bloat, but having a native function for this would lead to much cleaner diagrams.

Link to comment

As Ton pointed out, the True "constant" is actually a merge VI and it's actually quite new. I think it was only added in version 8.0 or thereabouts. It was probably easier to do it as a merge VI than adding it to the palettes as a primitive.

QUOTE (jdunham @ May 7 2009, 11:46 PM)

but having a native function for this would lead to much cleaner diagrams.

I assume you've already created your own subVI for this?

Link to comment

QUOTE (Aristos Queue @ May 7 2009, 03:16 PM)

Because most people want double type for the numeric. But it is really nice on the BD constant to drop it and then, if you need floating point, to type in a value using a decimal point and the constant will automatically change to double type.

Learning little tidbits like this is why I try to read LAVA faithfully every morning. Thanks!

Link to comment

QUOTE (Black Pearl @ May 8 2009, 01:24 AM)

I've got both constants in 7.1

For loop: if you wire I to the outside (no indexing), you will get 0 if the loop iterates 0 and 1 times. Not so nice...

I agree that it's sort of counterintuitive at first, but what would you expect the result to be instead? Even though the For Loop executes zero times, there has to be a data value on the I wire coming out -- that's the nature of dataflow. In this case, what's happening is that wire is taking the default value of its datatype (I32), and that value is 0.

Link to comment

QUOTE (Justin Goeres @ May 8 2009, 08:40 AM)

I agree that it's sort of counterintuitive at first, but what would you expect the result to be instead? Even though the For Loop executes zero times, there has to be a data value on the I wire coming out -- that's the nature of dataflow. In this case, what's happening is that wire is taking the default value of its datatype (I32), and that value is 0.

Which is why I often wish LabVIEW had some convention of NULL implemented ...

Link to comment

QUOTE (jdunham @ May 7 2009, 01:46 PM)

Thanks, I knew about that. But what I really want is this... (And I've already suggested it to NI, but you never hear back about that kind of thing).

post-1764-1241729121.png?width=400

This construction comes up all the time if you use picture controls, or you do GUI arrangements, any kind of 2D coordinate stuff, or histogram bins, or limit testing... I know it sounds like feature bloat, but having a native function for this would lead to much cleaner diagrams.

You could submit this as an OpenG candidate.

Link to comment

QUOTE (Justin Goeres @ May 8 2009, 02:40 PM)

I agree that it's sort of counterintuitive at first, but what would you expect the result to be instead? Even though the For Loop executes zero times, there has to be a data value on the I wire coming out -- that's the nature of dataflow. In this case, what's happening is that wire is taking the default value of its datatype (I32), and that value is 0.

Not correct, as the 0 isn't coming out of the I when the loop executes 0 times, the tunnel is giving the default value of 0, which is the same as the I terminal output on first execution.

My only 'wish' would be, that executing a loop 0 times would resulat in a different value as executiong it 1 time (be it -1 as default value or start counting at 1). But I'm sure it won't be implemented, as it would certainly break a lot of existing code.

To push that point a bit further, I think that for loops of iteration 0 are potential troublemakers. If you don't use a shift register, you might end up with default data instead of the real data (happend once to me with a reference). It is neigther issueing a broken error nor throwing an error 'by wire', and can't be figured out after the loop has executed (actually not executed).

Another thing is, that the while loop isn't called 'repeat until' loop. In the text based languages I know, the difference is that the stop condition is evaluated before (unlike in LV) loop execution on a while statement. You can't run into that issue in LV-while loops (repeat until statements).

To summarize: you will seldom step on that trap so don't learn it by painful experience and difficutl to debug (and we all fear race conditions, don't we, and that's just because they are difficult to debug, ever had a 'Heisenbug'?).

One way to avoid that issue would be to have a required error in/out terminal on the for loops (with shift register behaviour) and an optional terminal 'allowed to execute 0 times'. But that would make such a basic concept a bit too feature-rich for standard users.

Felix

Link to comment

QUOTE (Yair @ May 8 2009, 12:33 AM)

QUOTE (TobyD @ May 8 2009, 07:17 AM)

You could submit this as an
.

Well the problem is I need it compatible with DBLs, I32s, I16s, Complex DBLs, XY points, and XYZ points, and arrays and clusters of all of those. It's easier to just do it with the plus and minus functions, but it can really make a mess. Obviously LabVIEW should allow functions with true polymorphic inputs, but while I'm waiting for that, I thought maybe they could throw in the PlusAndMinus for me.

Link to comment

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.