MooseX::Types to core?

2009-09-08 Thread Hans Dieter Pearcey
Whenever we've talked about coring MooseX modules, it's mostly been MXAH and MooseX::Types. Does anyone have any changes they'd like to see in MX::Types before it becomes, say, Moose::Types? (Moose::TypeConstraints?) For myself: * Warn/die on subtype DeclaredType = as Foo = where { ... }

Re: MooseX::Types to core?

2009-09-08 Thread Jesse Luehrs
On Tue, Sep 08, 2009 at 10:32:50AM -0400, Hans Dieter Pearcey wrote: Whenever we've talked about coring MooseX modules, it's mostly been MXAH and MooseX::Types. Does anyone have any changes they'd like to see in MX::Types before it becomes, say, Moose::Types? (Moose::TypeConstraints?) The

Coring Other Packages

2009-09-08 Thread Chris Prather
So Dieter started a thread about MooseX::Types already but I wanted to sort out the others that had been mentioned for moving to core. MooseX::StrictConstructor I know has been mentioned as a nice addition to core as an optional trait, one that perhaps Core modules should use. MooseX::NonMoose

Re: Coring Other Packages

2009-09-08 Thread Chris Prather
On Tue, Sep 8, 2009 at 11:41 AM, Chris Fieldscjfie...@illinois.edu wrote: On Sep 8, 2009, at 10:32 AM, Chris Prather wrote: So Dieter started a thread about MooseX::Types already but I wanted to sort out the others that had been mentioned for moving to core. MooseX::StrictConstructor I know

Re: MooseX::Types to core?

2009-09-08 Thread Hans Dieter Pearcey
Excerpts from John Napiorkowski's message of Tue Sep 08 12:58:41 -0400 2009: Honestly, I'd argue that moving MooseX::Types to core is the opposite of what I'd like to see. What I'd what to see is a more cleanly and clearly defined TC system, with all the bits needed divorced from Moose

Re: MooseX::Types to core?

2009-09-08 Thread Chris Fields
On Sep 8, 2009, at 12:09 PM, Hans Dieter Pearcey wrote: Excerpts from John Napiorkowski's message of Tue Sep 08 12:58:41 -0400 2009: Honestly, I'd argue that moving MooseX::Types to core is the opposite of what I'd like to see. What I'd what to see is a more cleanly and clearly defined TC

Re: Coring Other Packages

2009-09-08 Thread Chris Fields
On Sep 8, 2009, at 10:32 AM, Chris Prather wrote: So Dieter started a thread about MooseX::Types already but I wanted to sort out the others that had been mentioned for moving to core. MooseX::StrictConstructor I know has been mentioned as a nice addition to core as an optional trait, one that

Re: recommendations for a shortcut attribute accessor to another attribute sub-element.

2009-09-08 Thread Mark Blackman
On 8 Sep 2009, at 17:11, Jesse Luehrs wrote: On Tue, Sep 08, 2009 at 05:08:07PM +0100, Mark Blackman wrote: Hi, A quick question on recommended practice here. One of my Moose-using package attributes is a hash reference. What's the recommended accessor technique for a key in that hash if I

Re: recommendations for a shortcut attribute accessor to another attribute sub-element.

2009-09-08 Thread Jesse Luehrs
On Tue, Sep 08, 2009 at 05:08:07PM +0100, Mark Blackman wrote: Hi, A quick question on recommended practice here. One of my Moose-using package attributes is a hash reference. What's the recommended accessor technique for a key in that hash if I want a dedicated accessor/mutator for that

Re: MooseX::Types to core?

2009-09-08 Thread Hans Dieter Pearcey
Excerpts from Chris Fields's message of Tue Sep 08 13:14:20 -0400 2009: I think the suggestion is that type constraints be completely divorced from Moose so that other possibly non-Moose/CMOP projects can use it w/ o requiring Moose/CMOP. Or is that missing the mark John? I understand the

Re: Coring Other Packages

2009-09-08 Thread Jesse Luehrs
On Tue, Sep 08, 2009 at 11:32:41AM -0400, Chris Prather wrote: These are the ones that *I* can see looking at http://cpants.perl.org/dist/used_by/Moose what else looks likely? MooseX-MethodAttributes, maybe... I've never used it, but making more core perl stuff introspectable is a reasonable

recommendations for a shortcut attribute accessor to another attribute sub-element.

2009-09-08 Thread Mark Blackman
Hi, A quick question on recommended practice here. One of my Moose-using package attributes is a hash reference. What's the recommended accessor technique for a key in that hash if I want a dedicated accessor/mutator for that key? a dedicated method? or something Moose-y? Provisos: a) I want

Re: MooseX::Types to core?

2009-09-08 Thread Stevan Little
The TC objects use C::MOP level attributes though, so no types. Yes, I think it could be totally pushed outside of Moose, however a few things would need fixing, such as the type registry. If you were potentially using the TC system for something non-Moose related and didn't want Moose

Re: MooseX::Types to core?

2009-09-08 Thread John Napiorkowski
- Original Message From: Chris Prather perig...@gmail.com To: John Napiorkowski jjn1...@yahoo.com Cc: moose moose@perl.org Sent: Tuesday, September 8, 2009 1:41:39 PM Subject: Re: MooseX::Types to core? On Tue, Sep 8, 2009 at 1:32 PM, John Napiorkowskiwrote: -

Re: MooseX::Types to core?

2009-09-08 Thread John Napiorkowski
- Original Message From: Hans Dieter Pearcey h...@pobox.com To: moose moose@perl.org Sent: Tuesday, September 8, 2009 1:21:51 PM Subject: Re: MooseX::Types to core? Excerpts from Chris Fields's message of Tue Sep 08 13:14:20 -0400 2009: I think the suggestion is that type

Re: MooseX::Types to core?

2009-09-08 Thread Chris Prather
On Tue, Sep 8, 2009 at 1:32 PM, John Napiorkowskijjn1...@yahoo.com wrote: - Original Message From: Hans Dieter Pearcey h...@pobox.com To: moose moose@perl.org Sent: Tuesday, September 8, 2009 1:21:51 PM Subject: Re: MooseX::Types to core? Excerpts from Chris Fields's message of

Re: testing if an object has an attribute?

2009-09-08 Thread Chris Prather
On Tue, Sep 8, 2009 at 7:46 PM, mega...@gmail.com wrote: Yuri Are you doing this in order to effect duck-typing? If so, you may want to consider applying the attributes with a Role, and using this idiom: if ($obj-does('fooer')) {} Or there is the duck_type helper in

Re: testing if an object has an attribute?

2009-09-08 Thread Hans Dieter Pearcey
Excerpts from Yuri Shtil's message of Tue Sep 08 19:26:57 -0400 2009: What is the right way to see if an object has certain attribute? if (Moose::Util::find_meta($obj)-find_attribute_by_name(foo)) { do some stuff } I almost never find myself wanting this, though (except when writing

Re: testing if an object has an attribute?

2009-09-08 Thread Jesse Luehrs
On Tue, Sep 08, 2009 at 04:26:57PM -0700, Yuri Shtil wrote: What is the right way to see if an object has certain attribute? I tried if $obj-can('foo') {} but got burned when something like 'import/export' gets in a way. Do I have to maintain the list of attributes (an another attribute

testing if an object has an attribute?

2009-09-08 Thread Yuri Shtil
What is the right way to see if an object has certain attribute? I tried if $obj-can('foo') {} but got burned when something like 'import/export' gets in a way. Do I have to maintain the list of attributes (an another attribute !!!) as I create them? -- Yuri

Re: testing if an object has an attribute?

2009-09-08 Thread Stevan Little
Just FYI, I suggest usingTry::Tiny instead of plain eval. On Sep 8, 2009, at 8:07 PM, Yuri Shtil wrote: Hans Dieter Pearcey wrote: Excerpts from Yuri Shtil's message of Tue Sep 08 19:26:57 -0400 2009: What is the right way to see if an object has certain attribute? if

Re: testing if an object has an attribute?

2009-09-08 Thread Yuri Shtil
Hans Dieter Pearcey wrote: Excerpts from Yuri Shtil's message of Tue Sep 08 19:26:57 -0400 2009: What is the right way to see if an object has certain attribute? if (Moose::Util::find_meta($obj)-find_attribute_by_name(foo)) { do some stuff } I almost never find myself wanting