Rust Code in the Wild

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Wed Sep 4 21:33:53 PDT 2013


On Thursday, 5 September 2013 at 03:22:17 UTC, Meta wrote:
> pub struct BodyWorld<N, LV, AV, M, II, CM> {
>     world: World<N, Body<N, LV, AV, M, II>, Constraint<N, LV, 
> AV, M, II>>,
>     forces: @mut BodyForceGenerator<N, LV, AV, M, II>,
>     integrator: @mut BodySmpEulerIntegrator<N, LV, AV, M, II>,
>     detector: @mut BodiesBodies<N, LV, AV, M, II, BF<N, LV, AV, 
> M, II>>,
>     sleep: @mut IslandActivationManager<N, LV, AV, M, II>,
>     ccd: @mut SweptBallMotionClamping<N, LV, AV, M, II, BF<N, 
> LV, AV, M, II>>,
>     joints: @mut JointManager<N, LV, AV, M, II>,
>     solver: @mut AccumulatedImpulseSolver<N, LV, AV, M, II, CM>
> }
>
> This stuff is downright arcane. I'd say that D is in a far 
> better situation right now in regard to being syntactically 
> easy to parse and understand for the average coder.

I don't really know Rust, but is D really any better. It looks 
like you are defining variables with templated types:

     struct BodyWorld(N, LV, AV, M, II, CM) {
         World!(N, Body!(N, LV, AV, M, II), Constraint!(N, LV, AV, 
M, II)) world;
     ...

There has been some Rust code I've seen where a few symbols 
populate most of the code (GC something something). As an 
outsider it looks really horrible, but it did seem to convey 
useful information had I known what things meant. Math is another 
example of this, symbols provide great detail with little said; 
and it is horrible, because without continues use, someone 
somewhere is going to use a symbol you'd forgotten even existed 
(they have the nice benefit of being well defined from centuries 
of use though).


More information about the Digitalmars-d mailing list