Subject: | Strict & MultiMethods |
This is just a feature request, to start a little a discussion.
When i use Moose, one of the main modules i use is
"MooseX::StrictConstructors". The default way that Moose give us is a
new constructor where you can provide any garbage because it does not do
any checking if a key/value is allowed. These leads to errors where you
can just have a typo, and do'nt see them. If you have a attribut which
is optional and have a default then you even don't see an error, and it
works but probaly it doesn't work like excepted.
I think MooseX::StrictConstructor is a good think like "use strict;"
that should be by default on. MooseX::Declare is a little bit new so i
think now it is the time it is possibly to add this, even if it breaks
backward compatible. I think at the moment there is not so many modules
or applications out there that it hurts to mutch.
If for some reason somebody does not want strict constructors, to do
some hacking, we can introduce a new keyword where you can disable
strict constructor. Like somebady already can write "is dirty" to
disable cleanup an option like "is unstrict" would do it.
Another point is MooseX::MultiMethods. With MooseX::Method::Signatures
we already get Signatures and type checking. For me the logical next
step is that i can have the same function with different signatures,
like every other static typed languages have it. I think this is a great
step forward.