On Sun, 03 Feb 2013 13:42:57 -0500, Andrei Alexandrescu
<[email protected]> wrote:
On 2/3/13 1:32 PM, TommiT wrote:
On Sunday, 3 February 2013 at 18:28:06 UTC, Andrei Alexandrescu wrote:
[..]
This is a matter of visibility. The presence of a member precludes any
UFCS. Won't compile. Same for the 2nd example.
Just to be perfectly clear, it must be that this wouldn't compile
either, right?
struct S
{
int _n;
@property int prop() const
{
return _n;
}
}
@property void prop(ref S s, int n)
{
s._n = 42;
}
void main()
{
S s;
s.prop = 10;
}
Nope.
He means "Nope it wouldn't compile" in case that was confusing ;)
In general, functions must be overloaded within the same visibility
level/scope. If there is one overload at a level, ALL overloads must
exist at that level, or they are not seen.
-Steve