D dropped in favour of C# for PSP emulator

Jonathan M Davis jmdavisProg at gmx.com
Sat May 12 04:03:28 PDT 2012


On Saturday, May 12, 2012 13:39:54 Manu wrote:
> Awesome, although it doesn't end there. Local references are also very
> important.

Never going to happen. Walter doesn't like them (they also cause issues with 
the proposal to let ref take rvalues in D IMHO), but I don't remember the 
details. Regardless, I'd be shocked if they were ever introduced into D.

> They just have to sort out how to avoid the issues that C++
> 
> > has due to allow const& to take rvalues (which is why const ref in D
> > doesn't
> > currently take rvalues). So, there's a good chance that the situation will
> > improve considerably sometime soon.
> 
> What are these issues I keep hearing about? I'm not aware of any
> fundamental problem with ref in C++...
> Can you show an example of the problem the design is trying to avoid?

Go check out the discussion in the beta list. I can never remember the details 
beyond the fact that it screws up overloading:

http://forum.dlang.org/post/4F84D6DD.5090405@digitalmars.com

> Well, in my line of work, if the cost of passing by value is greater than
> the cost of passing by reference, then the correct thing to do is to pass
> by reference. There is zero tolerance for wasting memory accesses on such a
> trivial operation.
> The only case where the cost of passing by value is ever less than by
> reference is if the struct contains a single primitive value for which the
> CPU has a dedicated register type. This is the only time we would ever
> tolerate passing by value.

Well, while I'm sure that your use cases are very important and may be normal 
in your industry, I don't think that they're normal in the programming world 
in general. If they were, languages like Java and C# would never have gotten 
anywhere in the first place. So, while D should definitely support what you're 
trying to do, it's not what the average programmer is trying to do. Most 
programmers don't care one whit about registers. They want the compiler to be 
effecient in what it does, but they don't usually worry about stuff like whether 
a particular variable will fit in a register or not. Certain industries and use 
cases care a great deal about that sort of thing, but not your average use 
case or your average programmer. In most cases, passing around a struct with 
several member variables isn't a big deal at all - especially since the cost 
is going to be drowned out by other operations very easily. But obviously, 
things are different for you and your particular use cases.

- Jonathan M Davis


More information about the Digitalmars-d mailing list