Java > Scala

bigsandwich bigsandwich at gmail.com
Wed Nov 30 12:58:41 PST 2011


Jeff Nowakowski Wrote:

> On 11/30/2011 01:38 PM, Walter Bright wrote:
> >
> > Yes, it is. What I meant by the "large and heavy rock" is the difficulty
> > of expressing any sort of semantics that are not Java semantics in the
> > JVM bytecode.
> 
> Fair enough.
> 
> > In C++, one does all the memory management manually.
> 
> But in C++ libraries are designed with this in mind. You didn't address 
> his point: "Unless you want to do all of the memory management yourself, 
> which pretty much results in not using phobos and most of the cool 
> features in D."
> 
> And isn't the point of D to relieve you of the burden of doing stuff 
> like memory management? You should read Tim Sweeney's (Gears of War 
> developer) "The Next Mainstream Programming Language", where the slide 
> for Gameplay Simulation says, "Usually garbage-collected." I assume by 
> this he means that for C++ the developers end up writing their own 
> garbage collector inside the program.
> 
> http://www.st.cs.uni-saarland.de/edu/seminare/2005/advanced-fp/docs/sweeny.pdf
> 
> If D could demonstrably solve the problems outlined in these slides, 
> you'd have a whole industry at your fingertips.

I don't usually post, but "someone is wrong on the internet" (http://xkcd.com/386/) :)

"Usually garbage collected" in the case of Unreal refers to Unreal Script which is not C++ at all.  Its a language similar to Java that is compiled into bytecode.

Most games use allocations schemes for different parts of the game, including garbage collection.  You wouldn't want to use GC in performance critical code anyway, so it probably doesn't matter that its that slow.  

What does matter is having a way to isolate GC to the few libraries where your willing to pay for it and turn it off for everything else.  It would be great if there was a way to build a static library and just pass a switch that would make compilation fail if there was GC allocation in the library.

Other good features if you want to push into game dev:
1) Be able to override allocators (ie new, delete, or whatever they are called in D now) so that you can allocate out of different heaps.

2) Be able to control when GC occurs (ie every x frames, or in between levels, or only when there is a lull in the action).


More information about the Digitalmars-d mailing list