Anyone ever considered named tuples?

Lawrence Kesteloot lk at
Mon Mar 23 18:24:28 PDT 2009

On Mon, Mar 23, 2009 at 3:28 PM, Paulo Levi <i30817 at> wrote:
> i'd like at least token self documenting semantic meaning as a library
> user - given by the library code.
> For instance:
> List<(String parentDirectory, String file)>
> getChildrenBindingToPosixMethod(File parent)

One of the advantages of using named types is that it gives you a
place to write documentation. Where would you document the meaning of
"parentDirectory" and "file"? Can either be null? Does parentDirectory
include the final slash? I don't think your example above is very
self-documenting when you consider the subtle questions a user might
have about the list contents.

You could put it in the javadoc for getChildrenBindingToPosixMethod(),
but surely several methods will eventually want to return or take that
list or one of its elements, and you don't want to duplicate that

Giving that tuple a name gives you a place to document it, and it
later encourages you to document it when the javadoc page is bare.
What you call typesystem pollution, I call javadoc richness.


More information about the coin-dev mailing list