I've gone back to DBPro to do an example for someone's plugin and wow there's so many issues remaining with the language. I thought I'd post this one as it takes the cake, and took me quite a while to spot as the compiler didn't seem to care:
` Make arrays using both the 'UDT1' and 'UDT2' types
dim myArray1(0) as UDT1
dim myArray2(0) as UDT2
` This works, as expected
myArray1(0).x = 13.37
myArray2(0).y = "Hello World"
` These don't, thus confirming both UDT1 and UDT2 get parsed
`myArray1(0).y = 13.37
`myArray2(0).x = "Hello World"
` Who was phone?
something_UDT1( myArray1(0) )
something_UDT2( myArray1(0) )
something_UDT1( myArray2(0) )
something_UDT2( myArray2(0) )
` End
wait key
end
` Types
type UDT1
x as float
endType
type UDT2
y as string
endType
` Functions
function something_UDT1( in as UDT1 )
print "something_UDT1 - " + str$( in.x )
endfunction
function something_UDT2( in as UDT2 )
print "something_UDT2 - " + in.y
endfunction
As you can see, I'm able to pass array indices directly to functions which under different circumstances produces a compiler error thus it isn't normally allowed by the language. However, when you order the code like this, the compiler not only allows this but it doesn't even care what type the arrays belong to and compiles fine.
You may wonder why I'm ordering it in such a fashion and the answer is that I'm using multiple files and I declare my types and such at the top, but this is besides the point as you can clearly see the compiler does read the UDTs, at least before I attempt to assign values to the array. Now I have to have fun rearranging my include files so the compiler warns me about this, as I wrongly assumed the language supported such an obvious feature and the lack of errors led me to believe it was fine.