develooper Front page | perl.perl6.language | Postings from August 2006

clarifying the spec for 'ref'

Thread Next
Mark Stosberg
August 23, 2006 15:22
clarifying the spec for 'ref'
Message ID:
I noticed in pugs, 'ref' does not return 'HASH' and 'ARRAY' as Perl5
does, but returns values including 'Hash', 'Array' and 'Array::Const'.

I don't find meaningful mentions of 'HASH' and 'ARRAY' by grep'ing
docs/Perl6 (or even "ref"!), so I wanted to check in here about the
meaningfulness of this change.

Personally, I dislike the change from HASH to 'Hash' because it seems to
 be change without a significant benefit. It's annoyingly different.

The ARRAY case is worse, because it seems I now need to write this:

 if ref $a eq any('Array','Array::Const')  {

If you are interested, here's code which illustrates cases when
'Array' is returned, versus 'Array::Const'

 my $a = [<a>];
 my $b = \@('b');

 say ref $a;
 say ref $b;

I'd like for 'HASH' and 'ARRAY' to keep working, or for the Perl6 docs
to justify the change.


Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About