Bug With Unqualified Class Reference?

Posted by Jeff Ledbetter on 15-Mar-2015 11:56

Hi.

This fails:

USING System.IO.*.

message Path:GetRandomFileName() view-as alert-box.

with the error " ** Path is ambiguous with rtb_path.path-guid and rtb_pname.path-guid (72)"

The following works:

message System.IO.Path:GetRandomFileName() view-as alert-box.

This behavior was observed on OE 11.3.2. This seems like a bug to me.

Posted by Simon L. Prinsloo on 15-Mar-2015 14:56

This is a known.... Um... For me it is an issue, but Progress responded with "So what? We designed it that way."

So I logged this enhancement request: https://community.progress.com/community_groups/products_enhancements/i/openedge/do_not_allow_possible_abbreviated_table_and_field_names_to_take_priority_over_class_names.aspx

In short, Progress decided to eliminate a close to zero risk by introducing a moderate to high risk.

 

Long version

The rationale is that namespaces are searched in the sequence it was added to the language, so abbreviated field names takes precedence over fully named (but not fully qualified) class names. That way they can't break existing code.

That way of reasoning is plain dumb.

Pre-exiting code from pre-OO times will not have USING statements. Giving priority to a class name ABOVE an abbreviated field name can't break pre-exiting code. Risk factor? Close to zero. The exception is if someone create the classes in the root of the propath, thus having no namespace, in which case the Afrikaans saying applies: "Dom mense moet seerkry." (Dumb people must get hurt [in order to learn].)

On the other hand, take any class with a static member in your code that is used in conjunction with USING. Add a new field to any table in the DB and let the name start with the class name. (Say you have a MyCompany.SomeSystem.Data.Util.Validate() class, add a logical field called "ValidateEmail" to a control file.)

Now everything using that class, which is often a worker class, built to reduce typing and therefore intended to be used with USING, will fail to compile. Risk factor? Moderate to high.

All Replies

Posted by Mike Fechner on 15-Mar-2015 12:07

Since a very long time the compiler prefers abbreviated table names where you want to refer to a class name with the help of using.

It was discussed a couple of times in this form as well.

It's is truly annoying and a time bomb. Code that compiles in our framework may fail to compile when used at one of our clients with their databases connected.

Von meinem Windows Phone gesendet

Von: Jeff Ledbetter
Gesendet: ‎15.‎03.‎2015 17:57
An: TU.OE.Development@community.progress.com
Betreff: [Technical Users - OE Development] Bug With Unqualified Class Reference?

Thread created by Jeff Ledbetter
Hi. This fails: USING System.IO.*. message Path:GetRandomFileName() view-as alert-box. with the error " ** Path is ambiguous with rtb_path.path-guid and rtb_pname.path-guid (72)" The following works: message System.IO.Path:GetRandomFileName() view-as alert-box. This behavior was observed on OE 11.3.2. This seems like a bug to me.
Stop receiving emails on this subject.

Flag this post as spam/abuse.

Posted by Jeff Ledbetter on 15-Mar-2015 12:26

Thanks. I didn’t know that it had been discussed previously.
 
A customer reported it us when trying to compile their code with their Roundtable database connected.  :-\
 
Jeff Ledbetter
skype: jeff.ledbetter
 
[collapse]
From: Mike Fechner [mailto:bounce-mikefechner@community.progress.com]
Sent: Sunday, March 15, 2015 12:08 PM
To: TU.OE.Development@community.progress.com
Subject: [Technical Users - OE Development] AW: Bug With Unqualified Class Reference?
 
Reply by Mike Fechner
Since a very long time the compiler prefers abbreviated table names where you want to refer to a class name with the help of using.

It was discussed a couple of times in this form as well.

It's is truly annoying and a time bomb. Code that compiles in our framework may fail to compile when used at one of our clients with their databases connected.

Von meinem Windows Phone gesendet

Von: Jeff Ledbetter
Gesendet: ‎15.‎03.‎2015 17:57
An: TU.OE.Development@community.progress.com
Betreff: [Technical Users - OE Development] Bug With Unqualified Class Reference?
Thread created by Jeff Ledbetter
Hi. This fails: USING System.IO.*. message Path:GetRandomFileName() view-as alert-box. with the error " ** Path is ambiguous with rtb_path.path-guid and rtb_pname.path-guid (72)" The following works: message System.IO.Path:GetRandomFileName() view-as alert-box. This behavior was observed on OE 11.3.2. This seems like a bug to me.
Stop receiving emails on this subject.

Flag this post as spam/abuse.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

[/collapse]

Posted by Simon L. Prinsloo on 15-Mar-2015 14:56

This is a known.... Um... For me it is an issue, but Progress responded with "So what? We designed it that way."

So I logged this enhancement request: https://community.progress.com/community_groups/products_enhancements/i/openedge/do_not_allow_possible_abbreviated_table_and_field_names_to_take_priority_over_class_names.aspx

In short, Progress decided to eliminate a close to zero risk by introducing a moderate to high risk.

 

Long version

The rationale is that namespaces are searched in the sequence it was added to the language, so abbreviated field names takes precedence over fully named (but not fully qualified) class names. That way they can't break existing code.

That way of reasoning is plain dumb.

Pre-exiting code from pre-OO times will not have USING statements. Giving priority to a class name ABOVE an abbreviated field name can't break pre-exiting code. Risk factor? Close to zero. The exception is if someone create the classes in the root of the propath, thus having no namespace, in which case the Afrikaans saying applies: "Dom mense moet seerkry." (Dumb people must get hurt [in order to learn].)

On the other hand, take any class with a static member in your code that is used in conjunction with USING. Add a new field to any table in the DB and let the name start with the class name. (Say you have a MyCompany.SomeSystem.Data.Util.Validate() class, add a logical field called "ValidateEmail" to a control file.)

Now everything using that class, which is often a worker class, built to reduce typing and therefore intended to be used with USING, will fail to compile. Risk factor? Moderate to high.

Posted by Mike Fechner on 15-Mar-2015 15:07

Well said, Simon!

Von meinem Windows Phone gesendet

Von: Simon L. Prinsloo
Gesendet: ‎15.‎03.‎2015 20:57
An: TU.OE.Development@community.progress.com
Betreff: RE: [Technical Users - OE Development] Bug With Unqualified Class Reference?

Reply by Simon L. Prinsloo

This is a known.... Um... For me it is an issue, but Progress responded with "So what? We designed it that way."

So I logged this enhancement request: https://community.progress.com/community_groups/products_enhancements/i/openedge/do_not_allow_possible_abbreviated_table_and_field_names_to_take_priority_over_class_names.aspx

In short, Progress decided to eliminate a close to zero risk by introducing a moderate to high risk.

 

Long version

The rationale is that namespaces are searched in the sequence it was added to the language, so abbreviated field names takes precedence over fully named (but not fully qualified) class names. That way they can't break existing code.

That way of reasoning is plain dumb.

Pre-exiting code from pre-OO times will not have USING statements. Giving priority to a class name ABOVE an abbreviated field name can't break pre-exiting code. Risk factor? Close to zero. The exception is if someone create the classes in the root of the propath, thus having no namespace, in which case the Afrikaans saying applies: "Dom mense moet seerkry." (Dumb people must get hurt [in order to learn].)

On the other hand, take any class with a static member in your code that is used in conjunction with USING. Add a new field to any table in the DB and let the name start with the class name. (Say you have a MyCompany.SomeSystem.Data.Util.Validate() class, add a logical field called "ValidateEmail" to a control file.)

Now everything using that class, which is often a worker class, built to reduce typing and therefore intended to be used with USING, will fail to compile. Risk factor? Moderate to high.

Stop receiving emails on this subject.

Flag this post as spam/abuse.

This thread is closed