Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

To be more explicit

   y = f(g(h(x)));
is really

   var hreturn;
   h(x, hreturn);
   var greturn;
   g(hreturn, greturn);
   // hreturn is no longer live
   var y;
   h(greturn, y);
   // greturn is no longer live
Looked at this way, a function can return any fixed-size type without a copy. Some languages, mostly those in the Pascal/Modula family, did this explicitly. Instead of having a return statement, within a function, the name of the function was the return value, and code could assign to it, or pass it by reference to another function.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: