develooper Front page | perl.perl6.language | Postings from May 2005

Re: trait and properties thru getter/setters

Thread Previous | Thread Next
From:
Brent 'Dax' Royal-Gordon
Date:
May 13, 2005 12:26
Subject:
Re: trait and properties thru getter/setters
Message ID:
b8b9a51105051312267e6547ab@mail.gmail.com
On 5/13/05, St├ęphane Payrard <stef@payrard.net> wrote:
> > > There is syntax to define trait and properties
> > > but is there an API?
> > >
> > >   my $b = eval '$a but true'; # setting a true property
> > >   # API to do it without an eval?
> 
> My question is more generic than my example.
> I may not know at compile time what is the value/trait name and its
> value.

Well, the value's pretty easy--just pass in a variable:

    my $b = $a is foo($bar);

As for the name, I'd be surprised if the standard symbolic-ref syntax
didn't work:

    my $b = $a is ::($foo)($bar);

-- 
Brent 'Dax' Royal-Gordon <brent@brentdax.com>
Perl and Parrot hacker

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