Skip Menu |

This queue is for tickets about the Moo CPAN distribution.

Report information
The Basics
Id: 92410
Status: resolved
Priority: 0/
Queue: Moo

People
Owner: Nobody in particular
Requestors: ribasushi [...] leporine.io
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: (no value)
Fixed in: 1.005000



Subject: Give prototypes to quote_sub (possibly others)
Currently it is not possible to write: has foo => ( is => ro, default => quote_sub '[]', lazy => 1, ); because quote_sub will slurp the rest of the arguments, and "lazy => 1" will be silently lost. Is there a reason we aren't declaring a ($) prototype on our imported functions to prevent this? Thought occured while writing https://github.com/dbsrgits/dbix-class/commit/bf302897b5 Cheers
On Thu Jan 23 10:29:15 2014, RIBASUSHI wrote: Show quoted text
> Currently it is not possible to write: > > has foo => ( > is => ro, > default => quote_sub '[]', > lazy => 1, > ); > > because quote_sub will slurp the rest of the arguments, and "lazy => > 1" will be silently lost. Is there a reason we aren't declaring a ($) > prototype on our imported functions to prevent this? > > Thought occured while writing https://github.com/dbsrgits/dbix- > class/commit/bf302897b5 > > Cheers
quote_sub accepts up to 4 parameters, so a prototype won't be useful. A separate sub would be required, and I don't know if it's a useful enough addition to justify it.
On Thu Jan 23 20:37:24 2014, haarg wrote: Show quoted text
> On Thu Jan 23 10:29:15 2014, RIBASUSHI wrote:
> > Currently it is not possible to write: > > > > has foo => ( > > is => ro, > > default => quote_sub '[]', > > lazy => 1, > > ); > > > > because quote_sub will slurp the rest of the arguments, and "lazy => > > 1" will be silently lost. Is there a reason we aren't declaring a ($) > > prototype on our imported functions to prevent this? > > > > Thought occured while writing https://github.com/dbsrgits/dbix- > > class/commit/bf302897b5 > > > > Cheers
> > quote_sub accepts up to 4 parameters, so a prototype won't be useful.
Indeed, a misread on my part. I was certain it was a single-arg function. Show quoted text
> A separate sub would be required, and I don't know if it's a useful > enough addition to justify it.
Given it's an import, and given it is most-useful in has() declarations... I for one would like a qsub ($) { ... } to use in such cases... Wonder what mst thinks. Anyhow - this is a wishlist as already marked, and the implementation is beyond trivial. It's a matter of executive decision :)
qsub has been implemented in Moo 1.005000