develooper Front page | perl.perl5.porters | Postings from March 2007

Re: [PATCH] Extend functionality of UNIVERSAL::DOES() so it handles additional roles, and works in subroutine form.

Thread Previous | Thread Next
From:
Tels
Date:
March 15, 2007 13:10
Subject:
Re: [PATCH] Extend functionality of UNIVERSAL::DOES() so it handles additional roles, and works in subroutine form.
Message ID:
200703152110.57098@bloodgate.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Moin,

On Thursday 15 March 2007 19:19:21 chromatic wrote:
> On Thursday 15 March 2007 06:09, demerphq wrote:
>
> Here is the crux of the problem:
>
> The only way you can make a method work on non-invocants is by making it
> not a method anymore, and if you do that to UNIVERSAL::DOES() it no
> longer belongs in UNIVERSAL (because it's not a method) and classes can
> no longer override UNIVERSAL::DOES() (because it's not in all objects and
> because it's no longer in UNIVERSAL).
>
> UNIVERSAL::DOES() is for invocants only!

I would like to inject something here:

This discussion highlights one of the basic problems of Perl 5: there are 
non-objects (aka the build-in types) out there. This makes it nec. to 
distinguish between these two (object or not?) and causes all sort of 
headaches.

Not only from the "is this thing an object" side of view, but also from the 
side of adding new "build-in" types. Note for instance all the problems 
with qr// and Regexp ("it's just something blessed into the class Regexp - 
which doesn't even exist or so), and bignum (it does go to great lengths to 
masquerade as a "normal" number, but it still shines through that it is 
just a fancy object).

If everything was an object, things would be sooo much simpler.

Nice to know that autobox solves a few (ifnot all) of these.

all the best,

tels

- -- 
 Signed on Thu Mar 15 21:07:02 2007 with key 0x93B84C15.
 View my photo gallery: http://bloodgate.com/photos
 PGP key on http://bloodgate.com/tels.asc or per email.

 "COMPASS [for the CDC-6000 series] is the sort of assembler one expects
 from a corporation whose president codes in octal."

  -- J.N. Gray
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2 (GNU/Linux)

iQEVAwUBRfm2YXcLPEOTuEwVAQKmhgf8DuFZHIMKFzidnoNLPMUgbMR94w/CXXpQ
uocEZ+fmye4/GRIw0d1qjff3i+1R+BBeh89dn6ihrcWHyNIADHhpfSZou+AcAquP
Jg576Z98vm7abSvkqM8atxLce3MRF58vfcKwo9XPoSKuqjd09Hw4u0EcFQA3X9IZ
Gus/izV13rsH6oqPO9XWnhs5zZDScNEYFf39uPYoBky+ByvEcSC3Bb2nf35UMKJ2
nbFGYa97XXl/G7e4xnPf554rdMdKuTWckXvBNZ2zSFYSD5Z8YyKAY9yntkWcKtAo
5y9+dT/vg2ok2HPtHXtnJugVn2tSILsI+nstpy3BnHZns6/IHclorQ==
=lRO/
-----END PGP SIGNATURE-----

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About