On Wednesday, January 8, 2003, at 01:32 PM, Michael Lazzaro wrote:
I would ask, if it's possible to inherit from Array or Hash, is it possible to inherit from one which has a constrained storage type?On Wednesday, January 8, 2003, at 02:13 AM, Damian Conway wrote:Michael Lazzaro wrote:The remaining big question, then, is whether you can truly subclass Array to achieve C<tie>-like behavior:
class MyArray is Array { ... };
my @a is MyArray;
Oh yes, I would certainly expect that this has to be possible.OK, next question. Is _THIS_ possible?class FileBasedHash is Hash { ...stuff... }; my %data is FileBasedHash('/tmp/foo.txt'); And if _that's_ possible, is _THIS_ possible? my $path = '/tmp/foo.txt'; my %data is FileBasedHash($path); Sorry, but I gotta ask. :-)
my WeirdHash is int Hash { ... }