Prevention of UFCS hijacking
H. S. Teoh
hsteoh at quickfur.ath.cx
Tue Aug 27 11:33:16 PDT 2013
On Tue, Aug 27, 2013 at 08:02:18PM +0200, Andrej Mitrovic wrote:
[...]
> Btw, why exactly is the following allowed to compile?:
>
> -----
> import std.conv;
> import std.stdio;
>
> struct S { }
>
> void main()
> {
> S s;
> writeln(s.text = "foo");
> }
> -----
>
> This translates into std.conv.text(s, "foo"). I'm not a fan,
> especially since 'text' is not a @property. But we've already reached
> the consensus that all functions can be called like properties (for
> some reason..), so I guess it's too late to change this.
We have? Really? I haven't been keeping track of all the details, but
my last impression was that we agreed that calling non- at property
functions with a=b syntax should be illegal.
T
--
LINUX = Lousy Interface for Nefarious Unix Xenophobes.
More information about the Digitalmars-d
mailing list