On Sunday, 21 September 2014 at 15:10:23 UTC, Andrei Alexandrescu
wrote:
Is this because of problems with ref's definition, or a natural
consequence of supporting ref parameters? -- Andrei
There is various reason why this is complex:
- classes must often be handled specifically.
- auto ref is not very controllable and tend to end up with an
combinatorial explosion of special cases.
- it is complex to find out if something is ref or not in
generic code.
- it is not possible to conditionally declare something as ref.
It is true of other qualifiers, but ref change the semantic in a
more deeper way than, say, dropping pure or @safe.
- you may want to use ref for very different semantics, which
lead to different policies about what should be ref or not. There
is no other way to implement these policies than spaghetti static
if with meatball code duplication.