[Edinburgh-pm] CPAN upload

Miles Gould miles at assyrian.org.uk
Wed Dec 21 12:39:48 PST 2011


On Wed, Dec 21, 2011 at 5:29 PM, Aaron Crane <perl at aaroncrane.co.uk> wrote:
> Miles Gould <miles at assyrian.org.uk> wrote:
>> On Wed, Dec 21, 2011 at 11:08 AM, Aaron Crane <perl at aaroncrane.co.uk> wrote:
>>> I suggest also looking at Makefile.PL.  The current version claims
>>> that the author is one A. U. Thor <a.u.thor at a.galaxy.far.away>, which
>>> seems moderately unlikely.

I changed it to my name, to reduce the number of frustrated users
trying to email a dead address. The POD gives clear credit to Eyal.

>> but "not added because capacity() has been exceeded
>> and we're already full of higher-priority stuff" feels like correct
>> behaviour that you might want to know about as a caller. So I think
>> the Right Thing is to […] return 0 on "insert failed because you're
>> over capacity".
>
> My naive reaction (without having thought much about how
> List::Priority might be used) is to disagree: I'd want an exception if
> `$container->insert($thing)` didn't leave $container with a $thing,
> regardless of the sort of container.  Perhaps extend the API with a
> `maybe_insert` method, which inserts only if there's enough spare
> capacity?  Though I'm aware this would be another API change, so you
> might decide to favour API stability even if you agree with me.

There are *checks* precisely zero modules on CPAN which depend on
List::Priority right now. Wow. Everyone seems to use POE::Queue::Array
(https://metacpan.org/module/POE::Queue::Array) instead. Which does
some things that List::Priority doesn't, but doesn't do some things
that List::Priority does - including the features that I chose L::P
for for my aiclass program :-)

> What are the use cases for the capacity-limit feature?

Here's mine: I was exploring a 19!-point space (about 10^17 points)
using A* tree-search. I was using a priority queue to store my
"frontier", ie the next points to explore, in order of how promising
they looked. But the frontier grew very quickly to the point where I
started to thrash my hard drive, causing Slowness, and eventually it
grew to the point where the OOM killer killed my program at 3am. So I
limited the capacity of the frontier to 1000, which was small enough
to keep the whole thing in RAM and make it go nice and fast. And I
didn't care too much about low-scoring points anyway.

> https://github.com/pozorvlak/List-Priority/blob/ade2a6b1d8c620d4bc9bc69de0859b43a7d1db06/Priority.pm#L41

Yes - I just wonder why the hell he put it in there! It seems a very
strange restriction to add. I'll knock it out and see how many tests
fail.

[Oh yes - we have tests now. Yay!]

Miles


More information about the Edinburgh-pm mailing list