Good morning,
Someone has an explanation why the compiler is unhappy with this:
IF 1 = 0 THEN @SomeAnnotation . MESSAGE "true" VIEW-AS ALERT-BOX . ELSE @SomeAnnotation . MESSAGE "false" VIEW-AS ALERT-BOX .
The error I receive on 11.6.3 is:
** Unknown Field or Variable name - @SomeAnnotation. (201)
** Could not understand line 2. (196)
If I surround the Annotation and the Message with a DO END block it works.
Must be a bug - right?
Sorry Mike, that doesn’t look like a bug to me… you’re in a middle of a statement there, allowing annotations to be present anywhere will make the language even more ambiguous so please just use an extra block if you must add annotations on then/each/case branches :)
<ProgressEmailLogo-png_2D00_150x42x2-png> Update from Progress Community
marian.edu Sorry Mike, that doesn’t look like a bug to me… you’re in a middle of a statement there, allowing annotations to be present anywhere will make the language even more ambiguous so please just use an extra block if you must add annotations on then/each/case branches :)
You received this notification because you subscribed to the forum. To unsubscribe from only this thread, go here.
Flag this post as spam/abuse.
Well, in their defence in compilers and parsers in general is not always easy to recover and come up with a meaningful error message :(
Marian, you were doing very well. The error makes perfect sense to me. Since it isn't DO, the compiler is trying to parse this as a statement. There are only a finite set of things that can be here. It's not a keyword, or a function or an x:y expression, etc, so it tries to resolve it as a variable/field reference. Since an annotation is not in the syntax it can't possibly say "You can't put annotations in the middle of a statement" - I assume that's what you want it to say.
Well, Mike's code doesn't look very elegant to me (that's personal), but if you look at https://documentation.progress.com/output/ua/OpenEdge_latest/index.html#page/pdsoe/abl-annotations.html there's clearly states "The compiler treats annotations as comments". So that would suggest that it is indeed a bug.
Treats them as comments meaning 'so they do not affect how your code runs’… if you stop at first sentence having those on separate line (starts with @) it’s already a bug cause comments we can drop them anywhere :)
Ah, something like @SupressWarnings… wonder if your version of proparse is supporting this, or Gilles’ one.
Dealing with Proparse is a piece of cake ;-)
Will be logging this as a compiler bug then. As like Bronce said - a comment should be legal in the IF THEN ELSE without a dummy DO block.
Still don't understand, why it is a bug in your eyes - just because you disagree with the coding style???
"no idea how they treat annotations but for the parser is probably just yet another ‘statement’,"
Annotations are certainly different from statements and the compiler treats them different from comments - as they can be used outside of methods and properties in a class - even outside the class block. That is not a bug - that is a feature.
Any yes - the fact that they cannot be used inside a "regular" statement makes them different from comments as well - also the fact that they have their own syntax rules between the opening @ and the closing period..
Who, me? I haven’t say I disagree with anything, I also accept others like to use ALL CAPS keywords so pretty easy going on that subject… I don’t see it as a bug because it doesn’t bothers me ;)