[fpc-devel] New language feature suggestion (probably not existing in Delphi)
Hans-Peter Diettrich
DrDiettrich1 at aol.com
Fri Dec 3 17:02:27 CET 2010
Max Vlasov schrieb:
> <DrDiettrich1 at aol.com <mailto:DrDiettrich1 at aol.com>> wrote:
> My experience with "const" methods in C++ often resulted in a bunch
> of cloned methods, with only calls to other non-const methods
> removed - a maintenance nightmare :-(
>
>
> Just curious, was it a "fight" with yourself or with someone else's
> code?
Both.
> Sure I had no experience with const methods, but I just can't
> imagine how function or procedures intended to caclulate/find/collect
> some information from the fields and properties of an object can be a
> problem in this field. One example comes to mind, sometimes developer
> wants to know how often a method is used, sure in this case there's no
> easy way to increase a feild of the object. Can you name some other
> examples?
Perhaps it's not so a problem with typical OPL code. Most critical is
passing along a const reference, to procedures that possibly can do more
with the object. Once you hit such an call tree, many of the called
procedures have to be converted (or cloned), to accept and work with
strictly const references.
DoDi
More information about the fpc-devel
mailing list