4 ms·
Any compiler or linter would likely complain about unused variables or code in such a situation.
by hodgedual 6y ago
Any compiler or linter would likely complain about unused variables or code in such a situation.
- benibela 6y agoNot if a part of the variable is used I just had this problem in a GUI. There was an edit view, correctly created and initialized with a default value. Then the user could enter a value, but whatever the user entered would be ignored.
- neltnerb 6y agoHow did you manage that? TLDR -- Event structures are my favorite new feature. Try them out and see if you still hate LabView nearly as much. I also suggest not actually using any of your GUI variables. Treat these like declarations and use local variables everywhere else. Otherwise the wires are impossible to trace and buggy to change. You've probably fixed it, but you can configure it to execute a code block when a value changes with Event structures. This structure is a little new, but I started LabView before it existed so I only started using it in the last year or two. It lets you define code to execute based on interrupt style events like "mouse release" on a button whereas in older versions I would wrap all my button checking logic inside of a big timed or while loop because otherwise as you've noted it won't update the value when doing the logic check. So my old standard style would be that there's a timed loop around each case structure that is checking buttons at 1kHz against a local variable version of the button's boolean, with a sequence inside the case structure that always resets the button state to zero at the end. Otherwise it doesn't check for button presses if one has already been pressed and is running something, or if you have no while/timed loop it doesn't even check at all since it's a run-once program. LabView patterns are really not very clear, and my least favorite bit is that there's at least ten ways to do anything, and only one or two are good but the others all logically seem like they should work until you look really close. Edit: Or maybe my least favorite part is that despite being a system designed for instrumentation and controls and data acquisition, my god is it a pain to plot anything.
- benibela 6y ago> How did you manage that? I probably started coding, and then forgot to finish it ... (not in LabView to be clear)
- neltnerb 6y agoThe labview "linter" is of course weirder but I think this is basically one. https://zone.ni.com/reference/en-XX/help/371361R-01/lvvianalyzerhelp/block_diagram_tests/ https://zone.ni.com/reference/en-XX/help/371361R-01/lvvianal... PS. Please don't take this as an endorsement of labview. It has its place in non-CS fields when there's high turnover so it's really bad if only the group's current programmer understands it. Talking academia here, I probably wouldn't use it in a more stable environment.
- darkerside 6y agoIndentation errors in Python can similarly short circuit control flow and are easy to miss for less trained eyes. Disclaimer: I actually love Python.