develooper Front page | perl.perl5.porters | Postings from September 2000

bless(REF, REF)

Thread Next
From:
Simon Cozens
Date:
September 2, 2000 01:26
Subject:
bless(REF, REF)
Message ID:
20000902092413.A28679@the.earth.li

In perldelta:
The semantics of bless(REF, REF) were unclear and until someone proves
it to make some sense, it is forbidden.

Bah. I had some code which depends on this. Let me try and explain.
One of the nice things about Perl's OO model is that if you don't like it, you
can write your own - in Perl. By providing a replacement bless() and
UNIVERSAL::AUTOLOAD you can pretty much come up with any kind of OO you like.
(No, I don't have an article on that, yet.)

One of the things I did was to make classes first-class variables, instead of 
packages, so you can pass them around and manipulate them with subroutines. I
did this by making classes into references. I've had to work around this
additional restriction in 5.7.0 by having a global hash of classes keyed to
their stringified references, but I'd really rather not have to. In fact, I'd
rather bless() took references and ref() was able to produce real references
instead of stringified ones. I'm happy to patch this (for 5.7.1, naturally) if
it's deemed to make sense.

-- 
Sendmail may be safely run set-user-id to root.
		-- Eric Allman, "Sendmail Installation Guide"

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