Hi Stef,
St�phane Payrard <[EMAIL PROTECTED]> wrote:
> Le Mon, Feb 09, 2004 at 09:52:28PM +0100, le valeureux mongueur
> Leopold Toetsch a dit:
Trop long d'introduction. Pas de valeur.
[ precise summary snipped ]
> P3 = PO[P1] # regular keyed access without flag
> # set a flag in P1 before doing the equivalent of C<P3 = PO[P1]>
> P3 = P0{P1}
It was already discussed (a long time ago, when current Key PMC went
into CVS) that we might need a different syntax do differenciate
in an instruction like:
P3 = Phash_like[Pkey] # Phash_like is an aggregate that does both ...
between integer or string keyed access.
> The C<get_*_key()> would test the flag to do the proper operation.
> To compare it with your proposition below: even if the flag lies in
> the subscript pmc, I think it is more a property of the operation than
> of the subscript pmc. It does not specify the type of a value. That's
> why I want to bundle the flag setting with the access operation.
> Anyway, a flag avoids to create a new set of keyed methods.
I think that concept isnn't generally suitable for compilers. Perl6 has
%P0[$key} and @P0[$key]. This syntax imposes some type restriction (or
coercion) on the key and defines the operation.
But with Perl5 syntax you are lost: The compiler wouldn't know, what to
emit.
There are of course more complicated examples:
P3 = P0[Pa; Pb; Pc] # intermdiate aggregates have to know ...
[ more compiler writers opinions needed ]
leo