Const ref and rvalues again...

Manu turkeyman at gmail.com
Fri Nov 9 00:33:45 PST 2012


On 9 November 2012 00:44, Jonathan M Davis <jmdavisProg at gmx.com> wrote:

> On Thursday, November 08, 2012 21:49:58 Manu wrote:
> > That's cute, but it really feels like a hack.
> > All of a sudden the debugger doesn't work properly anymore, you need to
> > step-in twice to enter the function, and it's particularly inefficient in
> > debug builds (a point of great concern for my industry!).
> >
> > Please just with the compiler creating a temporary in the caller space.
> > Restrict is to const ref, or better, in ref (scope seems particularly
> > important here).
>
> I honestly wish that in didn't exist in the language. The fact that it
> it's an
> alias two different attributes is confusing, and people keep using it
> without
> realizing what they're getting into.


I understand it's an alias for 'const scope', but what's this about scope
not working correctly? What's wrong with it?
It seems like precisely what you want in this case... you don't want a
temporary escaping the function you pass it to.
What's the problem?

If scope worked correctly, you'd only
> want it in specific circumstances, not in general. And since it doesn't
> work
> correctly aside from delegates, once it _does_ work correctly, it'll break
> code all over the place, because people keep using in, because they like
> how
> it corresponds with out or whatever.
>

I like how it promises that the thing I pass can't escape the callee, not
that it's the natural english compliment to 'out'.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121109/aa16d87a/attachment.html>


More information about the Digitalmars-d mailing list