Does it really make sense for `ClassName` to accept objects overloading stringification?
Opened this issue · 1 comments
tobyink commented
Consider:
has ua_class => (
is => 'ro',
isa => t('ClassName'),
default => 'HTTP::Tiny',
);
has ua => (
is => 'ro',
isa => t('Object'),
default => sub { shift->ua_class->new() },
);
If somebody sets ua_class
to an object overloading stringification, and the stringification yields a valid classname, then what will ua
be?
This seems a source for very hard to diagnose bugs, especially as things like warn $self->ua_class
will hide the issue.
autarch commented
This is a good question, but I don't have a good answer. I feel like I could make an argument either way.