On Mon, May 14, 2007 at 09:57:24AM +0200, Bernhard Graf wrote:
> Matt S Trout wrote:
> 
> > >   do_something($alpha, $rs->find($id), $omega);
> >
> > I always do
> >
> > if (my $obj = $rs->find(...)) {
> >
> > for clarity.
> 
> You mean you'd do:
> 
>   if (my $obj = $rs->find(...)) {
>      do_something($alpha, $obj, $omega);
>   } else {
>      do_something($alpha, $obj, $omega);
>   }

I can't really see somewhere I'd have an API that wanted that, to be honest.

Optional parameters in the middle of the argument list strike me as a
design smell.

> > Opinions welcome, I'm not -overly- troubled either way although by
> > default I'd say the current conceptual consistency is the correct
> > answer.
> 
> At least documentation should clarify the fact, that find() returns a 
> list of row objects, that either has 1 or 0 elements.

A doc patch is definitely in order whether we change the behaviour or not.

My worry is people doing if and getting the return in list context, hence
seeing a returned undef as true, but equally I can see the convenience value
of changing the behaviour.

C'mon people, pitch in with arguments and opinions :)

-- 
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director    Want a managed development or deployment platform?
 Shadowcat Systems Ltd.  Contact mst (at) shadowcatsystems.co.uk for a quote
http://chainsawblues.vox.com/             http://www.shadowcatsystems.co.uk/ 

_______________________________________________
List: http://lists.rawmode.org/cgi-bin/mailman/listinfo/dbix-class
Wiki: http://dbix-class.shadowcatsystems.co.uk/
IRC: irc.perl.org#dbix-class
SVN: http://dev.catalyst.perl.org/repos/bast/trunk/DBIx-Class/
Searchable Archive: http://www.mail-archive.com/[email protected]/

Reply via email to