Newsgroups: perl.perl6.language
From: ydbx...@yahoo.com (Paul Hodges)
Date: Sat, 29 Nov 2003 09:13:32 -0800 (PST)
Local: Sat, Nov 29 2003 12:13 pm
Subject: Re: Properties
--- Smylers <Smyl...@stripey.com> wrote: I'd think that would depend on the current status of strictures. > Larry Wall writes: > > : if $x.foo { print "$x has property foo" } > > Or maybe the .bar notation is only for rvalues, and to create a > > $x but= bar; > I think that would be an unPerlish restriction; people who know Assuming no strictures at all, I'd rather expect Perl to autovivify properties much the way hash elements are created when you assign a value to a previously nonexistant key, but that's exactly the reason I *NEVER* leave strictures *or* warnings off, even in short little one-shot programs. If it's complex enough to save to a file, it's worth adding a couple of "use" statements to make sure I don't do something carelessly stupid. And if I try to set $o.bar when there's no bar property predefined on Accordingly, I'd expect Perl to stick out it's tongue, cross it's arms, On the other hand, properties are probably best scoped to a class, and class Foo has Array bar is rw = undef; > > ... as long as we limit the .bar notation to rvalues or to Agreed. > > lvalues on already-created properties. And in fact, we may > > be limiting the creation of properties to predeclared names, > That sounds like a much better solution. > And thanks for taking the time to answer Luke's questions so fully. Ditto. :) > Smylers __________________________________ You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||