Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Removing CODE slot in typeglob / Reversing "use subs ...;"

by shmem (Chancellor)
on Jan 03, 2008 at 23:30 UTC ( [id://660340]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Removing CODE slot in typeglob / Reversing "use subs ...;"
in thread Removing CODE slot in typeglob / Reversing "use subs ...;"

I wonder, is that a design accident or intended? you can assign to a typeglob slot (assigning a specific ref to that typeglob), but you cannot undef its value, you have to destroy the whole glob. You cannot assign e.g. an 'undefined subref' to a CODE slot, because... no such thing. Something undef is not a CODE ref.

Did you get told the rationale behind that? Does anybody know? Cloning a typeglob to get rid of one entry in it looks like "useless use of hoops" to me. IMHO there should be a syntax to remove slots, keys, values and all, as delete does with plain hashes.

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^4: Removing CODE slot in typeglob / Reversing "use subs ...;"
by stvn (Monsignor) on Jan 04, 2008 at 17:10 UTC
    Did you get told the rationale behind that? Does anybody know?

    No one told me or gave me any rationale. Most just shrugged and said "yeah its kinda messed up like that". You might note the distinct lack of typeglobs in Perl 6, I don't think they are really thought of as having been that great an idea in the end.

    -stvn
Re^4: Removing CODE slot in typeglob / Reversing "use subs ...;"
by Anonymous Monk on Jan 04, 2008 at 10:51 UTC
    It has to do with the method cache

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://660340]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-03-29 11:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found