The Expressiveness of D

Gary Whatmore no at spam.sp
Tue Nov 2 06:40:30 PDT 2010


The D way of returning tuples is:

  T!(int,int) ret;
  auto f = (ref T!(int,int) r){ r = e; };
  f(ret);

It doesn't look so bad if you think about it. The tuple is first stack allocated. It doesn't trigger heap allocation. High level scripting languages always cause extra heap allocation if you do

auto f = { return (1,2); };

It's much faster the D way.


More information about the Digitalmars-d mailing list