<div dir="ltr">2013/2/3 FG <span dir="ltr"><<a href="mailto:home@fgda.pl" target="_blank">home@fgda.pl</a>></span><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div class="im">On 2013-02-03 09:16, Andrei Alexandrescu wrote:<br>
</div><div class="im"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Walter and I have had a discussion on how to finalize properties.<br>
</blockquote>
<br></div>
Very reasonable in the majority of the proposal.<br>
I can't, however, get my head around 2-arg property functions:<br>
<br>
    int a_;<br>
    @property void a(int v, bool rev=false) { a_ = rev ? -v : v; }<br>
    a = 10;       // fine<br>
    10.a = true;  // this feels backwards, true is just an extra flag<br>
<br>
The boolean flag is optional and making it the rhs of the assignment suggests it is the value which will be set. On the other hand switching argument positions, resulting in true.a = 10 also feels very strange.<br>
<br>
I'd say: allow only 0 or 1 argument in properties.<br>
If you need more arguments, write a normal function for it.<br>
</blockquote></div><br></div><div class="gmail_extra" style>Two arguments @property function would be declared only in module level, and just be called with UFCS.</div><div class="gmail_extra" style>I think that functions annotated with @property must not have default parameters. As you show, it would introduce not little ambiguity.</div>
<div class="gmail_extra" style><br></div><div class="gmail_extra" style>Kenji Hara</div></div>