More magical AA semantics
monarch_dodra
monarchdodra at gmail.com
Sat Jan 12 14:47:57 PST 2013
On Saturday, 12 January 2013 at 22:44:19 UTC, monarch_dodra wrote:
> Q. Is this specific to *operators* that mutate? What about
> normal function?:
> a[0].mutate();
> Q.1) create a T.init and call mutate on it?
> Q.2) Throw an exception
I can answer that actually: It *must* throw an exception, because
the implementation would have a hook for "opIndexFunction", so it
would call "opIndex" + "Function", which would throw.
I'm not thrilled at the difference of behavior, but I guess we
can make an exception and support "lazy insertion" for numeric
operations.
More information about the Digitalmars-d
mailing list