Think about why the Transfer of Property Act treats a gift to a public library differently from an ordinary private settlement. The rule against perpetuity exists to stop property being frozen for private families indefinitely, generation after generation, so Section 14 caps how long a private interest can be held up. But a library open to an entire village serves the public, not a private line of successors, and Section 18 recognises that by exempting public-purpose transfers from the perpetuity rule altogether. So the gift of the land itself, running "forever" for the library, with a sensible reverter if it ever stops serving that purpose, is not the kind of mischief the perpetuity rule was written to prevent, and it stands.
The accumulation direction is a different matter altogether. Section 17 is not worried about who owns the property forever, it is worried about income being locked away instead of being put to use, which can starve an institution of funds and defeat the very purpose the donor intended. That is why the law caps accumulation at a limited period regardless of whether the underlying transfer is charitable or private, and the public-purpose exemption for perpetuity in Section 18 has no equivalent carve-out for accumulation. A direction to let income pile up for fifty years overshoots that cap by a wide margin, so it cannot be enforced in full - but the invalidity is confined to the excess, the accumulation clause is trimmed rather than the whole disposition being thrown out.
Put the two threads together and the picture is consistent, not contradictory - the library gift survives because the law specifically protects public-purpose transfers from the perpetuity bar, while the fifty-year accumulation order is cut down to size because that same protection was never meant to extend to open-ended income hoarding.
\[ \boxed{\text{The transfer is valid as it falls within the exception for public benefit, but the accumulation clause is void to the extent it exceeds statutory limits.}} \]