Final by default?
monarch_dodra
monarchdodra at gmail.com
Sat Mar 15 01:57:18 PDT 2014
On Saturday, 15 March 2014 at 07:36:12 UTC, Walter Bright wrote:
> 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.
Um... Read only attributes? Forgot the discussions about
@property ?
This makes sense to me:
class C
{
private int _x;
///Gets x
final int x() @property { return x; }
}
More information about the Digitalmars-d
mailing list