On Thursday, December 12, 2002, at 10:49  am, Piers Cawley wrote:

Luke Palmer <[EMAIL PROTECTED]> writes:

Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
Date: Wed, 11 Dec 2002 19:21:35 -0500
From: John Siracusa <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
X-SMTPD: qpsmtpd/0.20, http://develooper.com/code/qpsmtpd/

On 12/11/02 6:16 PM, Damian Conway wrote:
There's no need for special methods or (gods forbid) more operators.
Just:

   $obj1.id == $obj2.id

That's what the universal C<id> method is *for*.
I must have missed this (or forgotten it?) Any chance of it becoming .ID or
.oid or even ._id? I'm kind of attached to using an "id" method on objects
that represent things in a database... :-/
Well I use .str all the time, an .eq is one of my favorites!  Don't
take those, put a prefix on them!

Theoretically, there are sufficiently few Object methods to warrant
normal names.
Right now there are 'sufficiently few' Object methods, but I'm betting
that before the game is over there's going to a be a whole pile
more, just take a look at any Smalltalk image if you don't believe
me. But that's no reason for upcasing said methodnames. Anyway, you
haven't lived 'til you've added a suite of methods to
UNIVERSAL/Object; it's how we make Pixie work for instance.
But in fairness we do distinguish our method names with a different convention 'px_'. We prefix the methods more because people aren't used to the UNIVERSAL::* hierarchy being mucked around in, and methods suddenly cropping up may be surprising.

I think there may be a cultural issue here - in Smalltalk if someone messes with a method higher up in the hierarchy its visible quickly by virtue of the browser and the image. Adding a method in Smalltalk's MetaObject/Class/Object hierarchy isn't going to be that dangerous, because everybody can see that it has been added, and its therefore culturally exposed and therefore subject to debate[0]. Not so in Perl. Perl, of course, lets you stick a method that exists in any package anywhere on the system[1]. You can add methods to UNIVERSAL from anywhere, and this gets really complex when you start overriding existing methods. For example, if you're not happy with UNIVERSAL::isa, it can be replaced with a sub UNIVERSAL::isa {} pretty much anywhere[2]. You may get a warning but its pretty easy to turn it off, and tracking it down would be a real pain without some pretty serious reflection capabilities.

Of course pretty serious reflection capabilities would be Very Nice Indeed, but anyway...

--james.

[0] Read: argument.
[1] This is not a bad thing, its just a different thing.
[2] This probably is a bad thing in most circumstances.

Reply via email to