On Sat, Mar 10, 2012 at 01:43:35AM +0100, Timon Gehr wrote: > On 03/10/2012 01:10 AM, H. S. Teoh wrote: > >On Fri, Mar 09, 2012 at 06:50:50PM -0500, bearophile wrote: > >>Jonathan M Davis: > >> > >>>I don't know what the current state of UFCS is. > >> > >>I have found a possible problem in it, and probably there are some > >>missing parts, but it's working well. > > > >I found that x.foo doesn't work, it needs to be x.foo(). But we're > >deprecating omission of parentheses of non-@property functions anyway, > >and an external function can hardly be a @property of anything, so I > >don't think this needs to be fixed. > > > > UFCS for @properties seems to work according to the unit tests. > However, this makes @property ambiguous. foo = 2 will be the same as > 2.foo.
But 2.foo can never be interpreted as obj.foo = 2. I can't imagine any way to write 2.something and have it come out as obj.foo(2). The only remote possibility is inside a class/struct method, but in that case doesn't class/struct scope take precedence anyway? And presumably, you wouldn't be using pseudo-members if you're the one writing the class. Otherwise, if the programmer is deliberately trying to break the system, well, he shouldn't be surprised if things break. :-) T -- Тише едешь, дальше будешь.