> 1) It seems to me that allowing people to pass pointers to complex
> data structures would allow for more efficient memory management. I
> know about refnums, but Shane and others seem to imply that
> refnums/property nodes come with unnecessary GUI overhead. I hate
> pointers as much as anyone else, but being able to pass by reference
> without overhead would be HUGE. Is there a way to do this?
Actually, many of LV's datatypes are implemented with references, but
the diagram behavior is as if they were done by value. You mention that
you hate pointers, presumably this is in a serial language with a single
thread doing one thing at a time. Putting pointers in a parallel
language is ten times as bad. If instead of an array, you had a
reference to the array and the wire splits, the split pieces of code
will interact. The top branch will do a filter, then a power spectrum,
then plot. The middle one will subtract off a baseline and get an rms
value. The bottom one will simply plot. Since there is no longer any
sequencing between them, they interleave and you get jibberish. To
clean things up you either serialize them by putting them back into a
wire, make explicit copies, or use mutexes and semaphores to control the
order of execution. Ick.
So LV and most other dataflow languages have by-value semantics, meaning
that a wire represents the value, not a reference. On the otherhand,
all arrays and strings, are implemented by reference. The LV compiler
then determines how few copies are needed in order to maintain the same
behavior as if all were copies. The performance and memory usage
chapter gives examples of how this works.
Is it possible to do pointers? Sure, some have done it. You call a
block that copies or swaps the data into a private storage, and gives
back a pointer/reference/U32. Later in their diagram, they call passing
in the pointer and get back the array, or some portion of it. Of course
LV knows nothing about these pointers, and you can't operate on things
using LV icons until you go get the data. In many cases this uses just
as much memory as the simple code without the pointers.
>
> 2) The "avoid local variables when possible" bit is news to me. But I
> get the point

>
> 3) as far as I know, the GOOP projects use refnums, which are subject
> to the same overhead constraints as mentioned in (1).
>
Current GOOP uses the pointer approach mentioned above, and all objects
are referred to. The reads and writes are also serialized so that if
you ask for the data on an object, you wait for someone else to finish
working on the object, then you get the elements, modify and return
them. Again, parallelism and pointers are something you have to manage
pretty closely.
>
> 4) I think the problem with college courses is that most professors
> who design course curricula know about LabView, but they don't use it
> themselves -- their graduate students do. I've seen certain TA's make
> LabView instruction a pet project, but the novelty of G means that
> most students are happy to get to the point where they don't have
> broken wires everywhere (believe me, there's lots of swearing on
> LabView lab days). And most students are more worried about running
> their experiments than programming.
This is the approach in the basket weaving class, the physics class,
etc. It isn't unique to LV. And really, the point of the class is
rarely to learn LabVIEW or another language, it is to learn some
principles, and to do that you need to use some tools. Some students
embrace the tools and realize they will need to know this later in life
while others hack their way through just enough to get the desired A, B,
or C.
Enjoy,
Greg McKaskle