OO Completion Looking for some votes on eliminate error 7254

Posted by cverbiest on 11-Aug-2017 09:18

Error 7254 conflicts with Encapsulation as it requires the developer using a class to have knowledge of the internal workings of that class.

please vote for https://community.progress.com/community_groups/products_enhancements/i/openedge/eliminate_error_7254_and_allow_all_methodproperty_implementations_in_where_clauses

All Replies

Posted by marian.edu on 11-Aug-2017 12:04

Hi Carl,


afraid this doesn’t really breach the encapsulation, the developer doesn’t need to know that the property has a getter method where a buffer position is being changed… true, the compiler doesn’t do a very good job so this will only show-up at runtime :(

It’s true that this can be a nuisance, especially when someone later update the getter by adding a buffer reposition and that will pop-up as error everywhere the property was used in where clauses. From what I remember the reason for this error was the use of default buffers all over the place that might have caused issues when the same buffer was repositioned outside of the main for loop - inside a user defined function, later that applied to class methods.

Bref, imho this was just a quick and dirty fix due to the fact that the compiler wasn’t ‘smart’ enough to catch the actual race conditions - arguable this can be sometime difficult to spot since from one UDF one can call a bunch of other UDFs and so on and so forth so might be difficult to find if any of those UDFs involved was trying to reposition the same buffer, it was simply easier to throw that error as soon as the runtime finds a possible offending statement. It doesn’t really matter if the same buffer is used or not, repositioning the order buffer inside a UDF called as part of where clause on a for each customer block will still throw the error although there would not be any issue in that case.

One solution, if the compiler can’t be made really smart to catch this so that the runtime error is dropped - as I think is what you are proposing here - might be to restrict the use of default buffers inside getters, hell just make it for all class methods to really enforce encapsulation :)

The compiler should then be able to easily catch the fact that a default buffer is used, problem again will be the fact that we can call procedural code from those methods so the same restriction should apply for functions/procedures… while not a bad idea imho, afraid the horse has left the barn already, a change like that would require lot of changes on existing code where default buffers were used all over the place. Maybe a ‘strict’ compiler mode to enforce only local(named) buffers for methods/function/procedures, have to agree that even the OO purists out there would have to change some existing code to make it pass such a otherwise simple rule :(

 
Marian Edu

Acorn IT 
+40 740 036 212

This thread is closed