Larry Wall wrote:
> But my hunch is that it's
> a deep tagmemic/metaphorical problem we're trying to solve here.
> Such issues arise whenever you start making statements of the form
> "I want to use an A as if it were a B."  The problem is much bigger
> than just how do I translate Perl 5 to Perl 6.  It's questions like:
>
>     What makes a particular metaphor work?
>     Will the cultural context support use of an A as if it were a B?
>     How do we translate the user's thoughts to the computer's thoughts?
>     How do we translate one user's thoughts to another user's thoughts?
>     How do we know when such a translation is "good enough"?
>     How do we know when our mental model of an object is adequate?
>     How do we know when the computer's mental model of an object is adequate?
>     What does adequate mean in context?
>     Will the culture support partially instantiated objects?  :-)
>
> That's tagmemics, folks.  The main problem with tagmemics is that, while
> it helps you ask good questions, it doesn't give you easy answers for 'em...

Let me take a (feeble) crack at this:

It sounds like we're talking about something vaguely akin to C++'s
typecasting, where you treat an object of a given class as if it were
an object of a different class.  Another way to phrase this is that
you temporarily want to add role to the object.  "but" doesn't work
because you don't want the new role's default behavior to clobber
existing behavior that the object already has.  Perhaps "like"
instead, with the understanding that "$obj like Hash" means "try
$obj's dispatching first; if that doesn't work, try Hash's
dispatching".

The role in question needs to be an emulator, in that its methods
should have defaults that will make sense when mixed into the object
in question.  Therefore, Hash probably _wouldn't_ work, since Hash
probably isn't set up to work with $obj's internals.  You'd either
have to explicitly provide an appropriate emulator, or implicitly have
Hash find it (i.e., maintain a list of roles that do Hash, along with
a way to test each against $obj's class for compatability).  The
latter is probably a bit too much effort.

Or am I completely missing the point?

> But we'll not get true AI until a computer can understand a sentence like
>
>    In a hole in the ground there lived a hobbit.
>
> as if it were a human.  A human has the ability to execute "new Hobbit"
> before "class Hobbit" is even defined!

The essence of this is that you don't need to know everything about
class Hobbit in order to make use of it.  As with Stevan Little's
reference to "lazy objects", you only need to know as much about
Hobbit as is to be used to complete your current task.  In this case,
you don't need to know _anything_ about a Hobbit, yet.  By the time
you _do_ need to know something about it (such as how to form a mental
image of one), the script will presumably have given you the
neccessary information.  If not, you're likely to say something like
"what's a Hobbit?"

a.k.a. "forward referencing".  :)

--
Jonathan Lang

Reply via email to