On Oct 19, 2011, at 1:44 PM, Sherwin Daganato wrote:

> On Thu, Oct 20, 2011 at 12:46 AM, Stevan Little
> <[email protected]> wrote:
> [...]
>> 
>> So what about the above code does not work in Moose right now?
> 
> Stevan,
> 
> Well nothing really, besides the minor issue I reported in
> https://rt.cpan.org/Public/Bug/Display.html?id=71769

Yeah, for that I think it probably should work (and perhaps imply the "weaken 
=> 0"), but I will let Jesse and Dave decide that.

> I'm just new to Moose so I'm not confident it's the Right Thing To Do.

Looks fine to me, and very Moose-y

> I designed the code with MooseX::Role::Parameterized in mind which I
> doubt to be the closest thing to getting annotations/attributes in
> Moose

Well, again, annotations/attributes in Java/C# are really just compiler 
directives which are used in a number of ways. Your particular usage (and that 
of .NET's XML stuff and JAX) is to expand your written code with generated code 
based on information provided in the annotations/attributes.

What you are doing here is to pretty much exactly that. Each of your roles can 
affect the underlying code if you want. The attribute traits can cause specific 
types of accessors to be generated, you can generate other random methods for 
whatever you want, you can affect types, etc. The same with the class traits, 
etc.

> because the required role block will have no use and needs to be
> empty.

No idea what you mean here, are the roles you are apply empty? They really 
don't need to be.

> I was hoping I could get a nicer solution from Moose
> users/developers or be pointed to an existing MooseX:: module which I
> failed to find.

I guess I am wondering what is deficient about this approach? What would you 
like that you are not seeing here?

Also, you *really* should take a closer look at XML::Toolkit and also look at 
XML::RAbbit as well. Because what you are doing here is pretty much exactly 
what they are doing/did.

- Stevan






Reply via email to