Skip Menu |

This queue is for tickets about the MediaWiki-DumpFile CPAN distribution.

Report information
The Basics
Id: 55956
Status: rejected
Priority: 0/
Queue: MediaWiki-DumpFile

People
Owner: Nobody in particular
Requestors: amir.aharoni [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.1.1
Fixed in: (no value)



Subject: consider making text() return a reference
In Parse::MediaWikiDump the text() method on a page returned a reference to the text. I didn't make any calculations, but maybe returning a reference to the text saves memory and time. It will also make porting existing code from Parse::MediaWikiDump to MediaWiki::DumpFile easier. Or maybe you can implement a text_ref() method that returns a reference, in addition to the current text() method.
Returning a reference with the text() method on Parse::MediaWikiDump was a mistake from the beginning. I learned to program Perl around 1995 and at that time Perl did not have copy on write support; without copy on write support using a reference is indeed faster. With copy on write there is no benefit to using a reference. Parse::MediaWikiDump was created after copy on write but the mistake in the API made it through because I didn't know any better. It would be a mistake to put that bad behavior into MediaWiki::DumpFile. Tyler On Fri Mar 26 04:58:34 2010, amir.aharoni@gmail.com wrote: Show quoted text
> In Parse::MediaWikiDump the text() method on a page returned a reference > to the text. I didn't make any calculations, but maybe returning a > reference to the text saves memory and time. It will also make porting > existing code from Parse::MediaWikiDump to MediaWiki::DumpFile easier. > > Or maybe you can implement a text_ref() method that returns a reference, > in addition to the current text() method.
From: amir.aharoni [...] gmail.com
On Fri Mar 26 10:44:15 2010, TRIDDLE wrote: Show quoted text
> without copy on write support using a reference is > indeed faster. With copy > on write there is no benefit to using a reference.
OK. Thanks for telling me. Consider, then, adding a comment to the pod for the people who are used to the old behavior, something like "note that this method returns a string, unlike in Parse::MediaWikiDump, where it returns a reference". It's up to you.