Re: [PATCH] Make object contents optionally available
- From
Daniel Barkalow <barkalow@iabervon.org>
- Date
- May 17, 2005, 19:59 UTC
- Message-ID
- <Pine.LNX.4.21.0505171535510.30848-100000@iabervon.org>
- In-Reply-To
- <7vbr79fy22.fsf@assigned-by-dhcp.cox.net>
On Tue, 17 May 2005, Junio C Hamano wrote:
> That's what I meant to say by "types are special" but I phrased it so > badly.
Ah, okay. I'm not convinced that discriminating at all at the point where parse is deciding whether to free the contents is that useful; doing it based on type is just sufficiently easy that it could be worthwhile.
> And the callback would solve that naturally. Or you can > additionally give the callback the result of the parse_xxx(), > which would be even more useful. The callback can then throw > commit raw-data away based on the date, for example.
I don't think a callback has any advantage over turning on a flag to provide all unpacked objects, and having the program free them when it wants to, either right after whatever caused them to be parsed returns or later. I suspect that the main relevant thing is going to be the stack, not the data.
I have another idea, which is almost certainly too magical, but which would work: have library functions that parse objects return them unpacked if the objects they are given are unpacked. So, for example, pop_most_recent_commit() would unpack parents of a commit if the commit was unpacked. This would make everything work the way you'd expect if you didn't think about it, although it would probably be really surprising if you were thinking about it. I'm just mentioning this because it might make someone think of something similar but sane.
-Daniel *This .sig left intentionally blank*