Small feature request

Koroskin Denis 2korden at gmail.com
Sat Mar 29 12:09:23 PDT 2008


On Sat, 29 Mar 2008 21:17:40 +0300, Kevin Bealer <kevinbealer at gmail.com>  
wrote:

> Koroskin Denis Wrote:
>
> The code in both cases seems confusing, since you could just use:
>
> class Buffer {
>     char[4096] buffer;
> }
>
> It's a static buffer so the size can't change in any case.
>
> Kevin
>

Yes, but now it looks like a magic number to me. Moreover, I prefer using  
constant variables instead of buffer.length every time I need its capacity.

Anyway, my point is that if I initialize my variable like this:

T someVariable = someConstantExpression;

then someVariable.init should evaluate to someConstantExpression hereafter.

It does't break current rules, since

T someOtherVariable;

is identical to:

T someOtherVariable = T.init;

and therefore someOtherVariable.init == T.init.



More information about the Digitalmars-d mailing list