Comma expressions must die [Was: Reddit: why aren't people using D?]

Jesse Phillips jessekphillips at gmail.com
Thu Jul 23 18:38:30 PDT 2009


On Thu, 23 Jul 2009 21:22:03 -0400, Adam D. Ruppe wrote:

> 
> I could see a function returning it as being potentially useful for the
> x,y case:
> 
> Tuple!(int, int) getPoint() { return tuple(x, y); } ...
> 
> x, y = getPoint();
> 
> 
> But, a better way to do this would be:
> 
> Tuple!(int, "x", int, "y") getPoint() { return tuple(x, y); } ...
> 
> auto p = getPoint();
> // work with p.x and p.y
> 
> It is two brief lines longer to copy them to a local x and y if you want
> to.

Thanks for the tutorial, expect to see it on Wiki4D within a year :D



More information about the Digitalmars-d mailing list