Hodges, Paul writes:
> I assume you're setting the the value, so I think I understand it, but
> how about
>
> sub setvals ($o, [EMAIL PROTECTED]) {
> $o but= $_;
> $o.$_ = true;
> }
>
> Though I'm still "iffy" about that $o.$_ business..... I think
> $_(true) is better. I'm just fumbling for perspective.
Y'all seem to be missing a C<for> somewhere :-)
sub setvals ($o, [EMAIL PROTECTED]) {
$o but= $_ for @t;
}
I think that should work, as the right side of C<but> should always be a
property, so a property reference ought be interpreted correctly.
> One thing, though.... could I do this? >=o}
>
> my property (foo,bar,baz) ^is true;
> $thingy ^but= (foo,baz);
No, but you might be able to if you used proper vectorizing syntax ;-)
my property (foo,bar,baz) is sometrait; # is automatically distributes
$thingy Âbut=Â (foo,baz);
C<true> doesn't seem like a trait you would put on a property. C<true>
is a run-time property, and I think it would be awfully confusing to
make it a trait as well. If you're talking about some kind of
initialization, you might use:
my property (foo,bar,baz) is first(1);
Or C<is> might be correct if you're -- somehow -- deriving these
properties from the C<true> property. But I don't think that was the
intent.
> I'm pretty sure that syntax is way wonky -- would "is" be a
> vectorizable operator? Does it even qualify as an operator at all?
C<is> is definitely an operator, much in the same way C<my> is an
operator. Whether it's vectorizable is questionable, because in all
cases I've seen the vectorization is implicit. That is, if it has a
non-vector meaning, the meaning of:
my ($a,$b,$c) is foo;
is a little fuzzy. What's C<is> applying to if it's not applying to all
of $a, $b, and $c?
> > > then write allow() to build roles for each value passed in,
> > > maybe taking an arg to say whether they should be truly global,
> > > or built in the caller's namespace....
> >
> > Isn't that what my, our, Exporter, and the globalifying * are
> > all about?
>
> Probably, though I haven't seen anything yet about how the P6 version
> of the Exporter is going to handle things like specifying exportation
> of my() vars &co.
I'm pretty sure that the interface to Exporter can be cleaned up quite a
bit in Perl 6. For now, though, I think it's fine to assume it works
exactly like Perl 5's.
Luke
Ã