Return by 'ref' problems...

Manu turkeyman at gmail.com
Tue May 15 06:16:33 PDT 2012


Okay, here's another problem due to ref not being a type constructor.
If I have some function that receives an argument by ref, and then I take
parameterTypeTuple! of that functions parameter list, the ref bits are gone
from the typetuple.
If I give that tuple as a template arg, then the template parameters no
longer match the function it's wrapping...

I'm still thinking more and more that there's no solution to all the
problems with ref, other than changing it to use the syntax: ref(type), and
be a type constructor, like const/immutable/shared/etc...
I have problems with ref almost every day. If not in templates, in
function/delegate definitions, and the prior issues previously discussed.

No matter how I look at it, 'ref' really should be a type constructor. The
use of 'ref' fundamentally changes the variable from T to T*, that's a
critical difference, and can't just be lost when taking the typeof
something.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120515/99212b28/attachment.html>


More information about the Digitalmars-d mailing list