Re: RFC 163 (v2) Objects: Autoaccessors for object data structures
[email protected] (Dave Storrs) Tue, 19 Sep 2000 07:15:53 -0700 (PDT)
| Newsgroups | perl.perl6.language.objects |
|---|---|
| Message-ID | <Pine.BSF.4.10.10009190710390.52276-100000@megazone23.bigpanda.com> |
On Mon, 18 Sep 2000, Glenn Linderman wrote: > This is an interesting comment to be made about an interesting side effect of > this proposal. [snip] > (1) array elements can be accessed by name > (2) member data can be looked up quicker (by array index, rather than by > hashed name) [snip] > new RFC: [snip] > my @foo; # empty array > $foo ['month'] = 10; # $#foo == 1, $foo[0] == 10 > $foo ['day'] = 20; # $#foo == 2, $foo [1] == 20 > $foo ['year'] = 30; # $#foo = 3, $foo [2] == 30 This is an interesting idea, certainly...my question is, if we go with this idea, what will hashes be used for? Or are they simply rendered obsolete? (I find that hard to believe, but I can't offhand think of a usage that this doesn't cover.) This will require every array to carry around an internal hash mapping its symbolic names to the index at which they point. Dave