very disturbing behavior in compiler

Hi I am observing something that I don't think should happen.

Please see my attached file, and try compiling it on your machine.

Yes, there should be an error in the second call to 'Duplicate'.

However, no error is generated. I have observed this on two different computers.

Does anyone else see this error?

Thanks,

Jeff
Compiler_error.ipf (317 bytes)
A couple of observations:

Use <igor> and </igor> tags around the text to show Igor code in-line:

#pragma rtGlobals=3     // Use modern global access method and strict wave access.

Function TestCompile(ctrlName) : ButtonControl
    String ctrlName
   
    Make/O junk
   
    Variable j=7 // show what happens when you run this code
   
    if (j==7)
        String JunkStr="HeresJunk_"
        String JunkStr2="HeresJunk2_"
        Duplicate/O junk $JunkStr
        Duplicate/O $JunkStr2  // SHOULD NOT COMPILE ?

    endif  

End


It is true that the compiler accepts only one arg to Duplicate when two are needed.

Running the code does give a run-time error "expected wave name" on that line.

The compiler author could explain why, but I suspect it is because of the complexities of using $stringExpression.

--Jim Prouty
Software Engineer, WaveMetrics, Inc.
OK Thanks. However, for me this issue is somewhat more concerning, since a similar line of erroneous logic was present in the heart of a code that saves my experimental data (I did not write the code, but I have been trying to understand it). Two faulty lines such as this were immediately adjacent to the line that saves my data to file. No run time error was ever reported on this machine.