New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRC: Moose cleanups #21

Merged
merged 2 commits into from Jan 6, 2015

Conversation

Projects
None yet
2 participants
@xsawyerx
Contributor

xsawyerx commented Jan 4, 2015

My first entry for the Pull Request Challenge: a few Moose cleanups.

The code is at such a good state that there's no glaring issues to work on. Still, starting small, I've made some attributes read-only, removed lazy_build and all defaults are now coderefs.

xsawyerx added some commits Jan 4, 2015

Simple Moose cleanups:
* All the defaults have moved to a subroutine.

While it's correct to use a scalar value in a default, it's
more consistent to provide a subroutine and provides a more
common interface with other Moose-like systems (e.g., Moo).

* lazy_build has moved to explicit lazy and builder method.

"lazy_build" creates additional methods even though they
might not be necessary. It's not recommended.
Make as many attributes read-only as possible:
Immutability is good and allows to account for less changes and
moving pieces in the application.

Attributes which are changed by the application itself have been
skipped.

maros added a commit that referenced this pull request Jan 6, 2015

@maros maros merged commit 68fd7af into maros:master Jan 6, 2015

@xsawyerx xsawyerx deleted the xsawyerx:moose-cleanups branch Jan 7, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment