D dropped in favour of C# for PSP emulator

Dmitry Olshansky dmitry.olsh at gmail.com
Sat May 12 04:34:38 PDT 2012


On 12.05.2012 14:39, Manu wrote:
> On 12 May 2012 13:13, Jonathan M Davis <jmdavisProg at gmx.com
> <mailto:jmdavisProg at gmx.com>> wrote:
>
>     So, basically it's just the issue with neither ref nor const ref taking
>     lvalues.
>
>
> And the local references, and the bug.
>
>     If you duplicate the functions (or use auto ref if they're templated
>     functions), then it's not an issue.
>
>
> Yes it is. Passing by value is NOT passing by reference, it's a totally
> different operation. And what about non-const ref?
> 'in ref' would be very nice if it worked. It would basically replace
> 'const ref'.
>
>     It sucks to have to duplicate stuff, but
>     ref works just fine as long as you don't assume that it's going to
>     allow you to
>     pass rvalues to it.
>
>
> Well there's the bugs we've seen in optimised codegen.
> Duplicating with non-ref is not a solution. It's not even a workaround.
> The only workaround is to receive a pointer, which ruins all those cases
> in terms of syntax anyway.
>
>     Personally, I almost always just have functions take
>     structs by value, so it's a non-issue except for stuff like
>     opEquals, which
>     requires const ref (for at least one overload anyway).
>
>
> Well I think it's safe to say most people pass data structs by
> reference. If I saw someone pass a struct by val, I'd consider it a
> bug/typo and fix it.

Brr... most ranges are structs. And yes, they are passed by value 
(rightfully so).


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list