"body" keyword is unnecessary

Alvaro alvaroDotSegura at gmail.com
Sat Mar 26 02:57:19 PDT 2011


El 25/03/2011 22:40, piotrek escribió:

> Speaking of real world examples(is my world really real? :D)
> I hit "body" when I was doing an html generator. Long before that when
> I was reading language specification I looked with distaste at the "body"
> keyword in the contract programming section. Still no big deal.
>

A bit off-topic post:

I first hit "body" when porting the nbody benchmark test from the 
Computer Language Shootout to D.

http://shootout.alioth.debian.org/u32/performance.php?test=nbody#about

I wanted to write things like:

foreach (ref body; bodies) {
	body.x += dt * body.vx;
	body.y += dt * body.vy;
	body.z += dt * body.vz;
}

BTW, in that benchmark D, with my clean implementation, would perform 
similar to "Clean", about 1.7x slower than the fastest, Fortran. That is 
with GDC and all optimizations. DMD a bit behind with a 2.1x elapsed 
time. Both are behind Java, C and C++.



More information about the Digitalmars-d mailing list