develooper Front page | perl.perl5.porters | Postings from November 2001

Re: restricted hashes, and other readonlyness (was "clamp...")

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
November 5, 2001 13:57
Subject:
Re: restricted hashes, and other readonlyness (was "clamp...")
Message ID:
20011105215330.662.3@bactrian.ni-s.u-net.com
Graham Barr <gbarr@pobox.com> writes:
>On Mon, Nov 05, 2001 at 09:10:45AM +0000, Nick Ing-Simmons wrote:
>> Graham Barr <gbarr@pobox.com> writes:
>> >> >      Net::FTP object
>> >>
>> >> A possible - Graham care to comment?
>> >
>> >the only classes I can think of where you would want to restrict the keys
>> >are ones where you want to prohibit sub-classes.
>> 
>> I am assuming that either the base-class's "new" asks the class what
>> its keys are, or new is overriden in the subclass:
>
>I don't see the point in imposing that. I agree that resticted hashes have
>thier place. But I don't agree that object must use it.

Of course not. I am simply pointing out that if the base class 
DOES use restricted hashes, it can be coded in a manner that allows it 
to be inherited from by subclasses which co-operate with it.

At the risk of worrying the veterans of the psyco^Wpseudo-hash wars
one could even have a 'fields' utility ....

>
>Graham.
>
>> 
>> sub new
>> {
>>  my ($class,...) = @_;
>>  my %self;
>>  allowed($class->permitted_keys);
>>  ...
>> }
>> 
>> 
>> >Net::FTP is a sub-class
>> >of IO::Socket::INET, so IO::Socket::INET cannot be restricted and I have
>> >seen people sub-class Net::FTP too.
>> >
>> >Graham.
>> --
>> Nick Ing-Simmons
>> http://www.ni-s.u-net.com/
>> 
>> 
-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/


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