Forum Post: RE: Conflict between class and Database table

  • Thread starter Thread starter Simon L. Prinsloo
  • Start date Start date
Status
Not open for further replies.
S

Simon L. Prinsloo

Guest
Frank Meulblok Don't have a 11.2.1 on hand to test right now, but this seems to be solved in 11.3.3 at least. Code: USING System.Environment. message Environment:CommandLine. Compiles and runs just fine when I'm connected to a database with a table called EnvironmentControl, which has a field called "Commandline" It will fail if you add a field to any table and start the field name with "Environment". The compiler resolve all tokens in a specific sequence and class names are resolved last. If the class name can be resolved as an abbreviated field name, it will resolve to the field name and cause an error. Progress says it is to "prevent old code from breaking" and for that reason they cannot move the evaluation of possible abbreviations after class names. In my opinion that is nonsense, because I can thing of only two ways that it would "break old code": The class has no name space / package and match an abbreviated field in code. But having a class in the root package is bad practice and it should be fixed. Abbreviating field names in production code is also bad style, but it will keep compiling until someone change the source and introduce a USING that causes a conflict with the abbreviation. Since the programmer has the source open, fixing the bad code (abbreviations) are not an issue to me. As for an EXACT match between a field name and a class name, that is unfortunately a case where the field name will take precedence and you will need to fully qualify the class.

Continue reading...
 
Status
Not open for further replies.
Back
Top