Omittable parens is an evil

Nick Sabalausky a at a.a
Sat Jul 19 13:40:18 PDT 2008


"Mike" <vertex at gmx.at> wrote in message news:op.uej2aznskgfkbn at lucia...
> On Sat, 19 Jul 2008 21:42:22 +0200, Nick Sabalausky <a at a.a> wrote:
>
> Hey - I like that implicit value declaration very much. However, there 
> needs to be a way to declare pseudo properties (without the implicit 
> value), so I'd add an initializer to the property:
>
> class foo
> {
>     property int bar
>     {
>         value = void; // this is the initial value; void means that there 
> is no implicit value
>         // here be getters/setters
>     }
> }
>
> Maybe something like that?
>
> -Mike

My thought on that scenario was that if nothing within the "property int 
bar" block actually accesses the implied "value" member (I would think that 
wouldn't be too hard to detect, but maybe I'm wrong), then any access to the 
implied "value" from outside the block would be either completely 
meaningless or a sign that something is being done wrong. So in that case, 
the implied "value" is sort of "optimized away" (in a mannar of speaking, 
since it's not exactly the same as normal "optimizing away") and any attempt 
to access it from outside the block becomes an error.





More information about the Digitalmars-d mailing list