Then theres the whole debate about, maybe management can't reinvest that money properly, maybe the shares will actually lose value because of this.
A publicly traded company detains private information. That allows it to make a better estimate of its real value compared to the public. It that value is larger than its market cap, it ultimately creates more value for the shareholders to see the company do share repurchases than issue a dividend. Yahoo made the smart decision by repurchasing shares because they knew they would spin off the Alibaba stake - before that was made public - and that would lead to an appreciation of their market cap. They managed to buy shares at an average price inferior to the market price post release of that information.
Other factors can influence the choice between share buybacks and dividends; that was just one example.
However, the difference is when you expect a large influx of water in the future (e.g. the company is undervalued). Then tipping the container will cause each share to rise much, when the water arrives, than if you would drop the lid.
The same applies in reverse when the company is overvalued.
Now, you can apportion the value in the company in a few different ways, but there are two extreme ones:
1. The container is lying flat on the table. Each share has the same proportions of water and air as the others. If everyone's slice of the container is 10% air, you could pay it out to them evenly ("dropping the lid" of the container.) This shrinks the company, but it doesn't shrink the volume of "stuff" that anyone owns, modulo taxes.
2. You tip the container on its side so all of the air goes to one end. If the container is 10% air, now 10% of shares are all air, and the other 90% of the shares have no air at all. If you "paid out" the air now, you're doing a share buyback.
These accomplish basically the same thing for a company -- they have less cash (air) and less market cap (total volume).
They're about the same to the shareholders, too. If I have 10 shares in Yahoo and they use all their cash to do a buyback of 10% of their stock, I can sell one of my shares and be in exactly the same financial situation I would have been in had they decided to pay a 10% dividend (I'd have the same amount of cash, my shares would be worth the same amount, and they'd correspond to the same proportion of the company.)