[Reality] A state of near-permanent confusion

Christopher Armstrong reality@twistedmatrix.com
Mon, 02 Feb 2004 16:57:51 -0500


This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enigEB5A1E6E8F6F0FA25EF1A946
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Here are some clarifications.

Christopher Armstrong wrote:
> == Criterion problem ==
> 
> Currently we have a criterion(implementor) callable that we can pass to 
> collect(IWhatever, criterion, radius) to choose particular implementors, 
> but that's not good enough. For example: Our player says "go east". We 
> need to restrict our search to IWalkTargets that are physically east of 

This was meant to say "Finders", not "IWalkTargets". The door can be 
east, the IWalkTarget might be anywhere.

> Then again, maybe we don't really want to have this kind of mapping? If 
> we don't, then there's another use case that's basically equivalent: we 
> want to say "enter blue door"; we'll grep for IWalkTargets and we need 
> to restrict them to those knownAs("blue door"). Thus we need access to 

We'll grep for IWalkTargets and need to restrict their *finders*.

> the finder, not just the implementor.
> 
> == Exarkun's solution ==
> 
> So... exarkun tinkered around and changed criterion's signature to 
> (finder, implementor) instead of just (implementor). That satisfies the 
> above use-cases, but I'm still wondering if it's all we need: Maybe we 
> will need to do something with every find-implementor on the way to an 
> interface-implementor? I haven't thought of any use cases for that, though.

His change just involved changing

             if criterion(implementor):

to

             if criterion(self, implementor):

in Container.find.

Then we take advantage of knowing the *finder* in our criterion function 
(as well as the implementor), and check if the finder is east of the 
actor. We could only look at the IWalkTarget (the room) before, but now 
that we know the finder (the door), we can check it.

-- 
  Twisted | Christopher Armstrong: International Man of Twistery
   Radix  |          Release Manager,  Twisted Project
---------+           http://radix.twistedmatrix.com/

--------------enigEB5A1E6E8F6F0FA25EF1A946
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFAHsfqNp279O1/OG4RAmpKAJ9EDNjapGlIyQTFn8qCwCE9W+agSQCfQSG6
4JaeBdxEnstSNKHfvonncA4=
=cJWj
-----END PGP SIGNATURE-----

--------------enigEB5A1E6E8F6F0FA25EF1A946--