Rick,
I think perhaps I overstated how experimental MooseX::Declare is,
after discussing it with the other Moose cabal members we basically
settled on ...
MooseX::Declare is basically "stable enough" for people to use, but if
you choose to use MooseX::Declare you really should understand the
consequences of your choice.
- Debugging
MooseX::Declare still exposes a lot of it's internal details when an
error occurs which makes debugging not for the feint of heart (or for
people who have a pressing deadline).
- Performance
In order to provide the syntax extensions MooseX::Declare provides, it
incurs a performance penalty much higher then that of vanilla Moose.
Additionally MooseX::Method::Signatures must wrap your methods to
accomplish the signature checks, which will increase the overhead of
method calls.
- Stability
As was said above, MooseX::Declare is "stable enough" and is currently
being used in production environments, but it (more specifically
Devel::Declare) does have some known issues with newer versions of
Perl. The development team is committed to keeping MooseX::Declare
working, but given the deep (*cough* mst is evil *cough*) nature of
hacks in it's foundation it is quite possible there are still a few
edge cases yet to be found, odd things like the double package
declaration issue with Roles that Nick found.
...
In short, if you are willing to accept these things, go for it.
Otherwise we recommend vanilla Moose for classes and
MooseX::Params::Validate for methods.
RE: Bread::Board, ... thanks :)
- Stevan
On Jan 22, 2011, at 7:45 PM, Rick Apichairuk wrote:
Thanks Stevan! I think I will stop using MooseX::Declare. I'll just
wait
for Perl6. ;-)
Also, I really like your Bread::Board stuff. Very cool.
Thanks again,
Rick
-----Original Message-----
From: Stevan Little [mailto:stevan.lit...@iinteractive.com]
Sent: Saturday, January 22, 2011 12:41 PM
To: Rick Apichairuk
Cc: 'Nick Perez'; moose@perl.org
Subject: Re: Inheritance not working for some weird reason.
Quick disclaimer: I don't use MooseX::Declare personally and I
never have,
the level of sugar never appealed to me. That said ....
Honestly, I think the answer is to stop using MooseX::Declare.
After I saw your nopaste on #moose last night, I was looking over
MX::Declare and noticed that no major work has really been done on
it in
over a year. It is and has always been *highly* experimental and it
is
only
recommend for production use if you are willing to deal with some
of it's
fragility and odd edge cases.
This in contrast to plain Moose which is very *VERY* stable and for
which
inheritance always Just Works.
Maybe it is not as sexy, but if that is what you want, I recommend
Ruby ;)
- Stevan
On Jan 22, 2011, at 3:07 PM, Rick Apichairuk wrote:
-----Original Message-----
From: Nick Perez [mailto:n...@nickandperla.net]
Sent: Saturday, January 22, 2011 2:47 AM
To: Rick Apichairuk
Cc: moose@perl.org
Subject: Re: Inheritance not working for some weird reason.
Hey Rick,
So I had at look at your code and cleaned it up some what and
made it
run within a single file. In the future, please refrain from large
examples.
It really
helps people to see your problem better if you can make a very
small,
very succinct test.
From what I can see, this runs without problem. I did have to
change
the 'BAD' tests at the bottom to account for the proper values.
I tried your version and it did work. However, this code was
intended
to be in separate packages and that is when the error occurs. Did
you
run my version (in separate class files) and did it work for you?
What versions of MooseX::Declare, Devel::Declare,
MooseX::Method::Signatures, Moose, Class::MOP, and perl are you
running where this is a problem?
I have asked 3 other people to run the code and everyone experiences
the same problem. We all have varying versions of Moose,
MooseX::Declare, Devel::Declare, etc.
On my own machine, I am using the following versions:
This is perl, v5.10.1 (*) built for i686-linux-gnu-thread-multi
Moose
1.21 MooseX::Declare 0.32 Devel::Declare 0.006000
MooseX::Method::Signatures 0.34 Class::MOP 1.11
I had thought it might have been the new lines in
your class declaration that were the issue, but it still runs
without
issue on my
end even with the newlines. My other thought is perhaps the double
package declarations. You do realize that this:
package Foo;
use MooseX::Declare;
class Foo {...}
is essentially doing this:
package Foo;
use MooseX::Declare;
{ package Foo; ... }
right? I know I've had some trouble with Roles in the past where
double declarations of the package has caused issues. If you really
want the
package
declaration, I suggest scoping it with braces (this is what I've
done
when publishing modules to CPAN, so that it runs with the current
CPAN
toolset).
Thanks, I'll definitely keep this in mind in the future.
Rick