rfc: Change get_parent_map signature so that no parents is ()
Aaron Bentley
aaron at aaronbentley.com
Tue Jul 22 17:07:58 BST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
John Arbash Meinel wrote:
> Aaron Bentley wrote:
> | John Arbash Meinel wrote:
> |> If we prefer, we could have it return 2 values
> |> ~ present_map, ghosts = get_XXXX()
> |
> | I find multiple return values somewhat cumbersome, and it's clear that
> | the additional return value would not provide new information. So I
> | would prefer to only have a map returned, unless checking for ghosts is
> | overwhelmingly common.
>
> Well it is implicitly done by the _StackedParentsProvider which is
> rather common.
I meant actually writing it in code.
If we're commonly following "p = get_parent_map(r)" with "g =
r.difference(p)", then it makes more sense to do p, g = get_parent_map.
But if we're not commonly looking for ghosts, then returning a set of
ghosts is not helpful, and makes the API harder to use for little benefit.
> So it is more of: the underlying code has already done all the work to
> determine what you might be looking for, and instead of throwing that
> all away in favor of doing an O(N?) set difference later, just pass it
> up the stack.
I don't think that the performance of a set difference is worth worrying
about.
> Maybe as an optional parameter indicating that you want the information?
I'd rather always return ghosts than vary return type that way.
Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFIhgXd0F+nu1YWqI0RAjGWAJ0ef63Pg7eWH0IUb2BQQK1qByQd5ACfefrm
ECELox5ieSeQWUNncq6PRgM=
=3GcL
-----END PGP SIGNATURE-----
More information about the bazaar
mailing list