Compiler bug? (OpenInsight 32-Bit)
At 18 DEC 2008 02:56:40PM Bruce Cameron wrote:
Just came across this… tried out in 7.x, 8.x and 9.x and works the same way.
keypart1=12345"
keypart2=abcde"
open "myfile" to Openfile Then
write "Hello world" on OpenFile,keypart1:"*"keyypart2 else debugend
This will compile and will run without error and could mess up some databases for folks so I thought I would post it here.
I will also post in the tracker.
I won't say what the error is in this thread just for fun but can you find it?
At 18 DEC 2008 03:08PM support@sprezzatura.com wrote:
We suspect that implicit formatting has been reintroduced to help AREV32 people…
support@sprezzatura.com
The Sprezzatura Group Web Site
World Leaders in all things RevSoft
At 18 DEC 2008 03:28PM Bryan Shumsky wrote:
Yes, that's correct. The compiler now supports "implicit formatting" again, so it's possible (and legal) to say something like:
X=12345""L#10"
instead of
X=FMT("12345", "L#10")
This is for both AREV32 and CTO.
- Bryan Shumsky
Revelation Software
At 18 DEC 2008 03:41PM Bruce Cameron wrote:
Given that, then what are the rules then if…
keypart1=12345"
keypart2=abcde"
write "hello world" on openfile,keypart1:"*"keypart2
will write a record to openfile with thehello world" on openfile,keypart1"*"keypart2
will not compile and finally
write "hello world" on openfile,keypart1"*":keypart2
will write a record with thehello world" on openfile,"12345""abcde"
will write a record with the id=12345
?
At 19 DEC 2008 06:09AM cpates@sprezzatura.com wrote:
Bruce,
The implicit formatting should behave the same as it did in Arev, as the expression rules were added back into the OI compiler from the Arev 3.12 version.
I have to say I consider implicit formatting one of the great evils of Basic+ and it's responsible for many subtle bugs that aren't always obvious to spot - I've seen several "bug" reports about the compiler that came down to the re-introduction of implicit formatting for Arev32.
I think something that should be pursued by RevSoft in the new year is the capability to make implicit formatting optional so you can choose to remove it if you wish. I think it should be based on an "opt-in" switch of some kind - perhaps a #pragma statement and/or #define.
cpates@sprezzatura.com
Interstellar leaders in all things RevSoft
At 19 DEC 2008 02:05PM Bryan Shumsky wrote:
Hi, Bruce. Given your examples, none of the "implicit" formats work out to a real format code, so no formatting is applied. Specifically:
write "hello world" on openfile,keypart1:"*"keypart2
will write a record to openfile with theve formatted "*" with an invalid format, so only "*" is returned. The "*" is then concatenated to keypart1.
write "hello world" on openfile,keypart1"*"keypart2
will not compile because you're asking for an implicit format on an implicit format which isn't allowed
write "hello world" on openfile,keypart1"*":keypart2
will write a record with the*" is applied as the format code and does nothing, leaving keypart1 and keypart2 to be concatenated together. And finally
write "hello world" on openfile,"12345""abcde"
will write a record with theabcde" is applied to the string "12345", and - since that's not a valid format - only 12345 is returned.
Possibly confusing and troublemaking, I concur, but consistent…
Hope that helps,
- Bryan Shumsky
Revelation Software