isa => 'CHI::Driver'
> Since CHI.pm is empty except for its constructor, would it be a
> problem to
> create the anonymous class using both the driver and CHI itself as
> superclasses,
> so that attribute declarations such as this would pass type
> constraints?
>
> has cache => (
> is => 'ro',
> isa => 'CHI',
> lazy => 1,
> default => sub { CHI->new(driver => shift->driver) },
> );
>
> --
> You received this message because you are subscribed to the Google Groups "Perl-Cache Discuss" group.
> To post to this group, send email to perl-cach...@googlegroups.com.
> To unsubscribe from this group, send email to perl-cache-disc...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/perl-cache-discuss?hl=en.
>
It depends on how you define "problem". :) It's generally considered bad
practice for a constructor to return an object not of the same type as the
class it was constructed from -- it violates the principle of least
surprise.