In message <321088.49154...@web36901.mail.mud.yahoo.com>, Jacques G. <jacque...@yahoo.com> writes
If your file is opened, then comparing it to an empty string is what will cause an invalid data type error.

WHY!!!

If the datatypes don't match, then the result of the comparison is
FALSE, not INVALID.

It is logically correct to do such a comparison. The result I am looking
for is the logically correct response. It SHOULD NOT crash the program!

And it worked fine on INFORMATION, why not UV?

It is a bad idea to allow it, it encourages bad programming practices and it can hide a bug in your program for example if you do:

READ CAR FROM CARS ELSE CAR = ''
IF CARS #  ''  THEN

Here what was intended was to compare CAR to '' not CARS but having the S there is a typo. If we don't allow datatypes of different types being compared this bug has a greater chance of getting caught during development because the program will fail on comparing the file to a null string.

If you use FILEINFO it shows that you know that the variable you are testing is a file.

The big problem with your attitude is that you are assuming a typed language - and even then it's invalid.

In BASIC, *EVERYTHING* is a string (apart from file variables). Therefore any comparison should be valid.

And, using your own words against you - "it shows that you know that the variable you are testing is a file." What if I DON'T know (which is why I was doing the test!).

At the end of the day, an IF test for equality should return FALSE on a type mismatch, not CRASH. Because FALSE is the *correct* answer. That's what I absolutely HATE about "artificial stupidity". It thinks it knows better than me, and gives me what it thinks I should have, not what I asked for.

Cheers,
Wol
--
Anthony W. Youngman <pi...@thewolery.demon.co.uk>
'Yings, yow graley yin! Suz ae rikt dheu,' said the blue man, taking the
thimble. 'What *is* he?' said Magrat. 'They're gnomes,' said Nanny. The man
lowered the thimble. 'Pictsies!' Carpe Jugulum, Terry Pratchett 1998
Visit the MaVerick web-site - <http://www.maverick-dbms.org> Open Source Pick
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to