> Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
> Date: Thu, 7 Nov 2002 17:19:28 -0500
> From: "Mark J. Reed" <[EMAIL PROTECTED]>
> Content-Disposition: inline
> X-Julian-Day: 2452586.42675
> X-SMTPD: qpsmtpd/0.12, http://develooper.com/code/qpsmtpd/
> 
> [Recipients list trimmed back to just the list - it was getting ridiculous.
>  So everyone will get only get one copy and it may take a tad longer to
>  get there . . .]
> 
> On 2002-11-07 at 17:07:46, Dan Sugalski wrote:
> > Attributes are class-specific for a variable (okay, class instance 
> > specific, if you do Evil Things with multiple copies of a single base 
> > class in different legs of the inheritance tree and override the 
> > default behaviour of the engine) and not queryable at runtime without 
> > really nasty parrot assembly code.
> You won't be able to query attributes at run-time?  Even within
> the class?  I rather like the ability to loop through
> the attributes of an object with something like this Perl5 code:
> 
> foreach my $attr (qw(foo bar baz))
> {
>     print "$attr: $this->{$attr}\n";
> }
> 
> Will something like that not be possible in Perl6?  
                           ^^^^^^^^^^^^^^^^^^^^^^^^

I'm afraid that statement is false for all values of "something" :)

Could you just look through the lexical scope of the object?

    for $this.MY.kv -> $k, $v {
        print "$k: $v\n"
    }

Or would you look through the class's lexical scope and apply it to
the object?

    for keys $this.class.MY {
        print "$_: $this.MY{$_}\n"
    }

I think one of those two is possible. (Providing the .class method
exists and DWIMs)

Luke

Reply via email to