10-09-2009 01:11 PM
Hey if it's impossible, then why not simply say that instead of saying "I refuse to help"? And I am accepting ideas to solve the problem -- the USR approach is one I've used before and as ugly as it is, I agree that it will work. I was just hoping there was a simpler way of doing this since I need a global variable and the global variable construct in LV is far simpler to use than a USR/functional global/action engine.
10-09-2009 01:15 PM
10-09-2009 01:19 PM
Then there still is the array approach - one global (with just one name) to rule them all to hold all the values...
Oh, just forgot: you create serious race conditions when accessing the same global array from several places. Did I mention a FGV before?
10-09-2009 01:30 PM
boostinallovryou wrote:
I have to agree, Ben was the unprofessional one. "I refuse to help anyone use global variables..."Message Edited by boostinallovryou on 10-09-2009 12:47 PMMessage Edited by Support on 10-09-2009 01:11 PM
Ok it time for me to "take it like a man".
I apologize for the wording I used in the earlier post.
My intent was and still is to help LabVIEW users to learn and grow. One of the biggest barriers in learning a new language is trying to do so with inconsistant behaviour which is what we have when Global varibles are used in a multithreaded environment without extra code to protect (mutexes) the shared resource (global variable). I feel that I would be doing harm to the person asking, if I aid them in using Globals and the same time fail to offer a viable alternative.
I wrote that Nugget for that very purpose. I hope that you will still read that Nugget in the hopes that it can still help you!
Ben
PS: Thanks for the back-up gang!
10-09-2009 01:32 PM
boostinallovryou wrote:
I have to agree, Ben was the unprofessional one. "I refuse to help anyone use global variables..."
I have to side with Ben.
Friends don't let friends drive drunk.
And friends don't let friends use global variables.
10-09-2009 02:00 PM
Ah. I understand the source of the flames. I thought you were implying all global variables were bad, when it now sounds like you were saying that LabView's implementation of global variables is dangerous (no mutexes) -- never mind it's impossible to do what I wanted. That makes this whole forum thread make more sense.
Sorry for the misunderstanding.
10-09-2009 02:39 PM
knicewar wrote:Ah. I understand the source of the flames. I thought you were implying all global variables were bad, when it now sounds like you were saying that LabView's implementation of global variables is dangerous (no mutexes) -- never mind it's impossible to do what I wanted. That makes this whole forum thread make more sense.
Sorry for the misunderstanding.
I would say that the issues associated with globals is not unique to LabVIEW but apply to other languages as well. The one place where you don't run into many issues is when your application is single threaded. When single threaded you don't really encounter race conditions since by definition only one thing can ever access the global at a time. Any system that is multithreaded will encounter issues when using globals.
10-09-2009 03:07 PM
knicewar wrote:Ah. I understand the source of the flames. I thought you were implying all global variables were bad, when it now sounds like you were saying that LabView's implementation of global variables is dangerous (no mutexes) -- never mind it's impossible to do what I wanted. That makes this whole forum thread make more sense.
Sorry for the misunderstanding.
Exactly!
I am glad you got the message.
Re: Sorry....
No problem, from my side. I have to be used to it by now and besides I always keep a copy of the "Impossible Dream" around just to keep myself honest.
Ben
To dream the impossible dream,
to fight the unbeatable foe,
to bear with unbearable sorrow,
to run where the brave dare not go...
To right the unrightable wrong,
to love pure and chaste from afar,
to try when your arms are too weary
to reach the unreachable star!
This is my quest --
to follow that star
no matter how hopeless,
no matter how far --
To fight for the right
without question or pause,
to be willing to march into hell
for a heavenly cause!
And I know if I'll only be true to this glorious quest
that my heart will be peaceful and calm when I'm laid to my rest.
And the world will be better for this
that one man, scorned and covered with scars,
still strove with his last ounce of courage
To reach the unreachable stars!
10-09-2009 03:47 PM
I would like just add 5 cents into this flame, becuase the question was "how to create Globals programmatically".
Action Engines (or Functional Globals) (see link provided by Ben in second post) are very good for such tasks.
In some cases (if data typenot fixed) you can do this based on array of variants, so your Globals will be "programmatically created" for any type, something like that:
the code behind of Functional Global is pretty easy:
Full project in attachment.
best regards,
Andrey.
10-14-2009 10:02 AM - edited 10-14-2009 10:08 AM
boostinallovryou wrote:
I have to agree, Ben was the unprofessional one. "I refuse to help anyone use global variables..."
You obviously don't know what you are talking about.
Ben w-a-s trying to help.
And so did many others. So I won't propose what has already been properly proposed before.
EDIT portion: I didn't see the 2nd page to this thread 😉