Mercurial > pub > Impl
diff Lib/IMPL/lang.pm @ 280:c6d0f889ef87
+IMPL::declare now supports meta attributes
*bugfixes related to the typeof() operator
author | cin |
---|---|
date | Wed, 06 Feb 2013 02:15:48 +0400 |
parents | 4ddb27ff4a0b |
children | 77df11605d3a |
line wrap: on
line diff
--- a/Lib/IMPL/lang.pm Mon Feb 04 17:16:45 2013 +0400 +++ b/Lib/IMPL/lang.pm Wed Feb 06 02:15:48 2013 +0400 @@ -6,6 +6,7 @@ use IMPL::_core::version; use IMPL::clone qw(clone); use Scalar::Util qw(blessed); +use Carp qw(carp); our @EXPORT = qw(&is &isclass &typeof); our %EXPORT_TAGS = ( @@ -64,15 +65,17 @@ use IMPL::Const qw(:all); sub is($$) { + carp "A typename can't be undefined" unless $_[1]; eval {ref $_[0] and $_[0]->isa( $_[1] ) }; } sub isclass { + carp "A typename can't be undefined" unless $_[1]; eval {not ref $_[0] and $_[0]->isa( $_[1] ) }; } sub typeof(*) { - eval { $_[0]->typeof } || blessed($_[0]); + eval { $_[0]->_typeof } || blessed($_[0]) || ref($_[0]) || $_[0]; } sub public($) {