Re: Perl 6 - Cheerleaders?

2001-10-30 Thread Aaron Sherman
On Tue, Oct 30, 2001 at 04:29:15PM +1100, Damian Conway wrote: > >> > I'd do that like so (using Larry's preferred syntax): >> [...] >> > method INIT ($idval) { $.id := $idval } >> >> Hm... that looks to me like a regular ":="; is it? > > Yep. > > >> If so, what

Re: Quick question on subroutine declaration syntax

2001-10-30 Thread Aaron Sherman
On Tue, Oct 30, 2001 at 03:59:30PM +1100, Damian Conway wrote: > (Though I *do* harbour a secret desire to resurrect -> as a type specifier: > > sub foo (@args) -> rettype Hmm... I would have expected "is" to come in here: sub foo (@args) is IO::Handle > my $bar -> int; H

Re: Perl 6 - Cheerleaders?

2001-10-30 Thread Jonathan Scott Duff
On Mon, Oct 29, 2001 at 04:16:24PM -0800, Larry Wall wrote: > [EMAIL PROTECTED] writes: > : 3. If you declare a method *without* any parameter list: > : > : method foo {...} > : > :then the method call arguments (including the invocant?) > :are bound to @_. > : >

Re: Auto-creation of simple accessors (was: Perl 6 -Cheerleaders?)

2001-10-30 Thread John Siracusa
Okay, so we've got these guys auto-created if we want: method foo is lvalue { return $.foo } (plus or minus the syntax) which lets us do: $obj.foo = 5; print $obj.foo; So, what about simple array accessors? $obj.colors('red', 'green', 'blue'); $obj.colors = ('red', 'green

Re: Auto-creation of simple accessors (was: Perl 6 - Cheerleaders?)

2001-10-30 Thread Brent Dax
John Siracusa: # Okay, so we've got these guys auto-created if we want: # # method foo is lvalue { return $.foo } # # (plus or minus the syntax) which lets us do: # # $obj.foo = 5; # print $obj.foo; # # So, what about simple array accessors? Please note that these are my best guesses;

Re: Auto-creation of simple accessors (was: Perl 6 -Cheerleaders?)

2001-10-30 Thread John Siracusa
On 10/30/01 12:13 PM, Brent Dax wrote: > John Siracusa: > Please note that these are my best guesses; I'm not a Damian ;^). > > # $obj.colors('red', 'green', 'blue'); > # > # $obj.colors = ('red', 'green', 'blue'); > # > # $obj.colors = ['red', 'green', 'blue' ]; > > $obj.colors=('r

Perl 6 Object Oriented Operators [was: Perl 6 - Cheerleaders?]

2001-10-30 Thread Jonathan Scott Duff
On Tue, Oct 30, 2001 at 12:27:32PM +1100, Damian Conway wrote: > >> >($obj1, $obj2)->foo(@args); >> >> Is that merely sugar for: >> >> # errr, $_.foo(@args) ? >> $_->foo(@args) foreach($obj1, $obj2); > > No. What you showed would be achieved with either

Constants

2001-10-30 Thread Damian Conway
Aaron wrote: > > C means: "Once declared cannot be *assigned* to". > > > > But that doesn't mean one can't *bind* a new value to the > > variable (which would retain its C-induced unassignability > > after the binding). > > I understand that. I guess what I'm saying is, f

Re: Quick question on subroutine declaration syntax

2001-10-30 Thread Damian Conway
Aaron wrote: > > sub foo (@args) -> rettype > > Hmm... I would have expected "is" to come in here: > >sub foo (@args) is IO::Handle It would have to be: sub foo (@args) is type(IO::Handle) or something, I think. Unless Larry decides that every class/module name i

Re: Constants

2001-10-30 Thread David M. Lloyd
On Wed, 31 Oct 2001, Damian Conway wrote: > To me C means: "the *value* stored in the memory > implementing this variable cannot be changed". Which doesn't preclude > rebinding the variable to some *other* memory. > > But others have a different (and equally reasonable) interpretation of > C: "th

Re: Auto-creation of simple accessors (was: Perl 6 -

2001-10-30 Thread Damian Conway
John asked: > So, what about simple array accessors? Writing: class Demo; my @.colors is public; gives you: > $obj.colors('red', 'green', 'blue'); No. $obj.colors() takes no arguments. > $obj.colors = ('red', 'green', 'blue'); Yes. > $obj.color

Re: Auto-creation of simple accessors

2001-10-30 Thread Damian Conway
John icked: > > # # Change apple color, but leave the blue berry > > # $obj.fruit(apple => 'green'); > > # > > # print $obj.fruit('apple'); # green > > > > $obj.fruit{apple} > > Icky, looks "unencapsulated" to me :) [For the benefit of those playing alon

Re: Perl 6 Object Oriented Operators [was: Perl 6 - Cheerleaders?]

2001-10-30 Thread Damian Conway
> > method foo ( $me, $again : $big, $boy ) {...} > > > > should be able to be called via either of: > > > > foo $obj1, $obj2 : @args; > > or: > > ($obj1, $obj2).foo(@args); > > > This stuff brings to mind all sorts of questions: >

RE: Perl 6 Object Oriented Operators [was: Perl 6 - Cheerleaders?]

2001-10-30 Thread Brent Dax
Damian Conway: # BTW, colon isn't an operator (it's a separator), so it can't be hyped. What do you mean? We can hype the colon all we want! :^) --Brent Dax [EMAIL PROTECTED] Configure pumpking for Perl 6 When I take action, I’m not going to fire a $2 million missile at a $10 empty tent and h

Re: Auto-creation of simple accessors (was: Perl 6 -

2001-10-30 Thread John Siracusa
On 10/30/01 5:12 PM, Damian Conway wrote: >> # Change apple color, but leave the blue berry >> $obj.fruit(apple => 'green'); > > No. You want: > > $obj.fruit{apple} = 'green'; Hm, I think I'll be writing arg-type versions of that one because I'm not too comfortable with exposing the fac