Am 15.03.2014 08:36, schrieb Walter Bright:
On 3/14/2014 9:02 PM, Manu wrote:
That said, function inlining is perhaps the single most important API
level
performance detail, and especially true in OO code (which advocates
accessors/properties).

I find it peculiar to desire a 'final accessor'. After all,

     class C {
         int x;
         final int getX() { return x; } <= what the heck is this
function for?
     }

The only reason to have an accessor function is so it can be virtual.

I don't agree.

In any language with properties, accessors also allow for:

- lazy initialization

- changing the underlying data representation without requiring client code to be rewritten

- implement access optimizations if the data is too costly to keep around


--
Paulo

Reply via email to