On 10 May 2006 at 17:39, John Siracusa wrote:

> On 5/10/06, Jesse Brown <[EMAIL PROTECTED]> wrote:
> > I guess the question I should ask is:  Why NOT return the newly created
> > objects?
> 
> I just like to know the reasoning before I change the API :)  The code
> examples are exactly what I was looking for, thanks.  The only thing I
> remain unsure of is the scalar context return value.  I don't like it
> returning the number of items unless there's a good reason for it.  It
> seems like that info is already available elsewhere.  The other
> alternatives are:
> 
> * Return a reference to an array of added objects
> * Return the first added object.
> 
> Hm, I'm not sure I like those much either.  What I'm worried about is this:
> 
>     $widget = $o->add_widgets($some_widget);
> 
> The only way that works is if add_widgets() returns the first added
> object when called in scalar context.  But that's a pretty odd
> behavior.  Opinions?

Return $o?

I like it very much, when methods return $self because then it is possible to 
chain them.

Michael



-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rose-db-object mailing list
Rose-db-object@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rose-db-object

Reply via email to