To see what is currently happening visit http://www.perl6.org/
Objects : Rationalizing ref, attribute::reftype, and builtin:blessed
Maintainer: Damian Conway <damian@conway.org> Date: 14 Sep 2000 Last Modified: 18 Sep 2000 Mailing List: perl6-language-objects@perl.org Number: 224 Version: 2 Status: Frozen
This RFC proposes that rather than three separate mechanisms (in three
separate namespaces) to determine object typing information, Perl 6
simply extend the ref function to return all the necessary
information in a list context.
In Perl 5, the class into which an object is blessed is returned by
calling ref on a reference to that object. To determine the
underlying implementation type of the object, attribute::reftype is
used. To determine whether or not a reference refers to a blessed
object, <builtin::blessed> is used.
It is proposed that the behaviour of ref be altered in Perl 6 so that
in a list context it returns up to two values: the underlying
implementation type of the object (always returned), and the class into
which the object is blessed (only if the object is blessed).
Thus:
if (builtin::blessed $ref) {
$type = attribute::reftype $ref;
$class = ref $ref;
}
else {
$type = ref $ref;
$class = "<no class>";
}
print "Object of type $type, blessed into $class\n";
Would become:
($type, $class) = ref($ref);
$class ||= "<no class>";
print "Object of type $type, blessed into $class\n";
All existing calls to ref in a list context would have to be
translated to scalar ref.
Trivial.
None.