Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Properties

Newsgroups: perl.perl6.language
Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.stanford.edu!nntp.perl.org
Return-Path: <fibon...@babylonia.flatirons.org>
Mailing-List: contact perl6-language-h...@perl.org; run by ezmlm
Delivered-To: mailing list perl6-langu...@perl.org
Delivered-To: perl6-langu...@perl.org
Date: Mon, 1 Dec 2003 13:37:06 -0700
To: "Hodges, Paul" <Paul.Hod...@BELLSOUTH.COM>
Cc: d...@lighthouse.tamucc.edu, perl6-langu...@perl.org
Subject: Re: Properties
Message-ID: <20031201203706.GA30579@babylonia.flatirons.org>
References: <9C375DDD9B669243A2D78FCD607E894003E4FD28@bremo-jg>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <9C375DDD9B669243A2D78FCD607E894003E4FD28@bremo-jg>
User-Agent: Mutt/1.5.4i-ja.1
X-Spam-Check-By: la.mx.develooper.com
X-Spam-Status: No, hits=-2.7 required=7.0 tests=CARRIAGE_RETURNS,IN_REP_TO,QUOTED_EMAIL_TEXT,REFERENCES,SPAM_PHRASE_00_01,USER_AGENT,USER_AGENT_MUTT version=2.44
X-SMTPD: qpsmtpd/0.26, http://develooper.com/code/qpsmtpd/
Approved: n...@nntp.perl.org
From: fibon...@babylonia.flatirons.org (Luke Palmer)
Lines: 72

Hodges, Paul writes:
> I assume you're setting the the value, so I think I understand it, but
> how about
> 
>  	sub setvals ($o, *@t) { 
>           $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, *@t) {
        $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
Ã