Tuples citizenship

Jonathan M Davis jmdavisProg at gmx.com
Fri Mar 2 01:41:05 PST 2012


On Friday, March 02, 2012 10:27:02 deadalnix wrote:
> Le 02/03/2012 00:09, Jonathan M Davis a écrit :
> > When you're looking to mutate existing variables in the caller, using out
> > parameters results in cleaner code.
> 
> I'd argue that not mutating parameter result in cleaner code most of the
> time.
> 
> > Tuples are inherently messier, because you
> > have to deal with multiple return values. They also often do poorly when
> > you need to use the functional programming, because often you want all of
> > the return values for later use but only want to pass _one_ of them to
> > the function that you're passing the result to.
> 
> The first time I encountered tuple was using Caml. This claim doesn't
> support my practical experience.

Yes. Functional languages use tuples. But I'm talking about chaining functions 
like you would in a functional language. But functional languages use pattern 
matching and other stuff to make it not as big a problem as it is in D, and 
often in functional languages, you _still_ have to do their equivalent of 
assigning the pieces of the tuple to variables. Tuples are a bane of function 
chaining.

- Jonathan M Davis


More information about the Digitalmars-d mailing list