Re: Custom object constructors

2009-08-26 Thread Moritz Lenz
Kevan Benson wrote: > That said, I submit that it's a very confusing part of the language as > defined currently, and I haven't seen a very thorough explanation of the > purpose of each method in the chain the instantiates a new object. S12 > touches upon them slightly, but not in enough detail

Re: Custom object constructors

2009-08-20 Thread Kevan Benson
Jan Ingvoldstad wrote: On Thu, Aug 20, 2009 at 10:44 PM, Kevan Benson wrote: That said, I submit that it's a very confusing part of the language as defined currently, and I haven't seen a very thorough explanation of the purpose of each method in the chain the instantiates a new object. S12 to

Re: Custom object constructors

2009-08-20 Thread Jan Ingvoldstad
On Thu, Aug 20, 2009 at 10:44 PM, Kevan Benson wrote: > > > That said, I submit that it's a very confusing part of the language as > defined currently, and I haven't seen a very thorough explanation of the > purpose of each method in the chain the instantiates a new object. S12 > touches upon them

Re: Custom object constructors

2009-08-20 Thread Kevan Benson
Moritz Lenz wrote: Kevan Benson wrote: Should there not be a way to define object constructors with custom signatures that can be usefully invoked like a normal constructor? Currently, defining a BUILD method for a class with a specific signature doesn't seem to allow for the object to be inv

Re: Custom object constructors

2009-08-20 Thread Moritz Lenz
Kevan Benson wrote: > Should there not be a way to define object constructors with custom > signatures that can be usefully invoked like a normal constructor? > > Currently, defining a BUILD method for a class with a specific signature > doesn't seem to allow for the object to be invoked by new

Re: Custom object constructors

2009-08-19 Thread David Green
On 2009-Aug-19, at 4:37 pm, Kevan Benson wrote: I'm aware there's a default constructor that allows named parameters to be set, but I think the usefulness of allowing specific constructors that take defined parameters and initialize the object as needed should not be overlooked. E.g. my

Re: Custom object constructors

2009-08-19 Thread Daniel Ruoso
Em Qua, 2009-08-19 às 15:37 -0700, Kevan Benson escreveu: > Should there not be a way to define object constructors with custom > signatures that can be usefully invoked like a normal constructor? What's the problem with method new(Str $timestamp) { self.SUPER::new(ts => strptime('...',$times

Re: Custom object constructors

2009-08-19 Thread Kevan Benson
I think the "too much magic" is in automatically creating the appropriate "new" method with that signature. I idea is to get the standard behavior, which is to define a method that's signature is used for the instantiation. Currently, I believe you have to define at least new and BUILD, not

Re: Custom object constructors

2009-08-19 Thread Mark J. Reed
I'm confused. The signature of initialize is used by Class.new in Ruby; the signature of __init__ is used by class_name() in Python... How is doing the same thing too much magic? Or am I misunderstanding the suggestion? On 8/19/09, Kevan Benson wrote: > > Should there not be a way to define obj

Custom object constructors

2009-08-19 Thread Kevan Benson
Should there not be a way to define object constructors with custom signatures that can be usefully invoked like a normal constructor? Currently, defining a BUILD method for a class with a specific signature doesn't seem to allow for the object to be invoked by new with that signature and be