Re: new method question

2008-08-22 Thread John M. Dlugosz
Moritz Lenz moritz-at-casella.verplant.org |Perl 6| wrote: Attributes need to have a twigil, so it would be has $.name The syntax has $name; with no twigil is legal according to S12. Perhaps the original poster (Xiao Yafeng) might like to read

Re: new method question

2008-08-22 Thread Moritz Lenz
Xiao Yafeng wrote: > There are no barewords in Perl 6, but it seems new method is an exception: > > class Dog { > > has $name; Attributes need to have a twigil, so it would be has $.name > method bark () { > say $name; > } > } > my $p = Dog.new(

Re: "new" method

2004-04-06 Thread Dan Sugalski
At 1:16 PM -0700 4/4/04, chromatic wrote: On Sun, 2004-04-04 at 10:17, Leopold Toetsch wrote: .sub __init method is AFAIK the constructor. It gets called automatically for all parent classes and the class itself and is the best place to put attributes for objects in place and set these to the

Re: "new" method

2004-04-05 Thread Leopold Toetsch
Chromatic <[EMAIL PROTECTED]> wrote: > On Sun, 2004-04-04 at 10:17, Leopold Toetsch wrote: >> .sub __init method > I personally want to pass arguments to the initializer ("constructor" > really isn't the right term). I expect HLLs will want to do the same. There isn't yet an official way to ach

Re: "new" method

2004-04-04 Thread chromatic
On Sun, 2004-04-04 at 10:17, Leopold Toetsch wrote: > .sub __init method > > is AFAIK the constructor. It gets called automatically for all parent > classes and the class itself and is the best place to put attributes for > objects in place and set these to their default values. I personally wan

Re: "new" method

2004-04-04 Thread Uri Guttman
> "C" == Chris <[EMAIL PROTECTED]> writes: C> How about some variation on "create"? just please make sure it has the missing 'e'. :) uri -- Uri Guttman -- [EMAIL PROTECTED] http://www.stemsystems.com --Perl Consulting, Stem Development, Systems Architecture, Design and C

RE: "new" method

2004-04-04 Thread Chris
How about some variation on "create"? --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.593 / Virus Database: 376 - Release Date: 20/02/2004

Re: "new" method

2004-04-04 Thread Leopold Toetsch
Jens Rieks <[EMAIL PROTECTED]> wrote: > Hi, > Chromatic and I are unsure what the best name for a constructor method is. .sub __init method is AFAIK the constructor. It gets called automatically for all parent classes and the class itself and is the best place to put attributes for objects in pl