in reply to Re: Re: Re: •Re: On Declaration
in thread On Declaration
Er, I think you made a mistake in your example. Did you really mean @h? Don't you mean %h?
Assuming that you mean %h, I personally see no difference. $r2 and $r1 are identical in all respects as far as perl is concerned. And this is my point. my $x=do { \my @anon }; is identical in all useful aspects to my $x=[];. Without using magic there is no way for an external entity to tell if a reference to an array is a reference to a named scalar that is now out of scope or if it is a reference to an array that never had a name. And since there is no way for perl to tell the difference IMO you can only be confusing people when you say a "reference to an anoymous array" in any other curcumstance than saying that the [] symbols (normally) create one.
you know all of the references to the anonymous data are accounted for.
Im not sure I understand what you mean here. I dont need to account for anonymous data. Perl does it for me. :-)
"a reference to an anonymous array containing a reference to an anonymous hash" is giving more information than saying "a reference to an anonymous array containing a reference to a hash."
My problem with this is that if used your description for the documentation for an argument for a subroutine then somebody might think that is ok to say foo([{}]) but that it not ok to say my (%h,@a); @a=(\%h); foo(\@a). If you leave the issue of anonymous objects to the discussions of how to construct one then no such confusion arises.
The latter makes me want to ask, "which hash?"
You already have a reference to it, why do you care what and or if it has a name?
Let me take this a step further. Why dont you add "lexical" and "dynamic" to your description? After all a lexical array is different from an anonymous dynamic array. (Or is it? IMO its not, but whatever :-). So why not say "a named lexical reference to an anonymous dynamic array containing a reference to a lexical anonymous hash"?
Bah! Truth be told, id rather say "an arrayref of hashrefs" than any of the above.
:-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Re: Re: •Re: On Declaration
by sauoq (Abbot) on Jun 17, 2003 at 20:24 UTC |