develooper Front page | perl.perl6.internals | Postings from June 2005

Re: Keys

Thread Previous | Thread Next
From:
Leopold Toetsch
Date:
June 1, 2005 02:14
Subject:
Re: Keys
Message ID:
200506010905.j51957Q18785@thu8.leo.home
TOGoS <chumps_53705@yahoo.com> wrote:

[ anwser rearranged for readability ]

> --- Leopold Toetsch <lt@toetsch.at> wrote:
>> TOGoS wrote:
>>
>> > Why not extend this to properties, too?
>>
>> > foo.hello becomes
>> >
>> >       'hello'
>> >       string
>> >       as-property
>>
>> Because that's an attribute access:
>>
>>    $P0 = getattribute foo, "hello"

> perl6-internals: the place to go to have people tell
> you things you already know and not actually answer
> your question at all.

???

Anyway - and to run the risk of stating again something you already know -
here is a more verbose explanation:

Perl has keyed access on hashes and arrays:

  $v = @a[$k]   and   $v = %a{$k}

Both would translate to Parrot's:

  v = a[k]

and the meaning "indexed" vs "hashed" access would be lost. To get that
information into the opcode, Dan proposed to construct keys with an
"as-xxx" bit to discern these two cases.

You asked to extend that to properties (which are actually attributes).
Well there is no ambiguity in accessing attributes. The attribute name
is a string. There is no need to complicate things and replace an access
with (mostly) constant strings by an extra key PMC which has to be
constructed first.

leo

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About