--- Leopold Toetsch <[EMAIL PROTECTED]> wrote: > TOGoS <[EMAIL PROTECTED]> wrote: > > > --- Leopold Toetsch <[EMAIL PROTECTED]> 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
Ah. Because you'd need to create a key PMC. (I didn't mean to sound especially annoyed - it's just that people talking past one another seems to happen a lot around here) My view that as long as this construct to indicate 'as' is being considered, that it might as well be generalized to mean more than just array or hashtable access. You could let language designers use it for any sub-element access they come up with. (though I don't know how this would play with vtables or whether the mmd stuff covers that) accessing::a::constant accessing.an.attribute.1.with.an.int.as.its.name accessing['something']['by-index'][42] accessing{'something'}{'by-name'} accessing->something->by->some->yet->to->be->invented->way and'yes'i'know'this'isn't'valid'perl'6 it:is:hypothetical:language Of course, PMCs could feel free to treat them all the same way. I'm not proposing that this should replace getattribute (maybe complement it), but for array/hash/constant/other type things it could be very useful for languages that like to distinguish between many ways of accessing sub-objects. __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com