Skip to content
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

A few questions. #14

Closed
wants to merge 1 commit into from
Closed

Conversation

wolfsage
Copy link
Contributor

This PR has one question on the code directly (but nothing to actually merge, just start discussion).

Aside from that:

You can specify a non-sub for @Has attributes:

@HAS = ( x => {} ),

This will crash at runtime with a not-a-code-reference. Would it be possible/better to do this check at compile time (unitcheck?) when finalizing the class to make sure attributes are properly formed?

Also, $IS_ABSTRACT/$IS_CLOSED are writeable after the class has been compiled, should this be
locked somehow? Deleting/modifying %HAS also modifies closed objects after they are supposed to have a consistent state. Is this acceptable/intentional?

One final thing, ->new() doesn't check for invalid parameters being passed to the constructor. Should it? Or is that up to a sugar layer?

@@ -246,6 +246,7 @@ sub INSTALL_FINALIZATION_RUNNER {
# an eval STRING;
|| (caller(3))[3] eq '(eval)';

# Any reason to use private API instead of public here?
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am sure I had a reason at one point, but I don't recall it now, so, no, it should use the public API.

@stevan
Copy link
Owner

stevan commented Jun 24, 2016

So, yes, we need more validation of input, I purposefully left it out for now to keep the code simple and the design more "obvious". The same is true for $IS_{ABSTRACT,CLOSED} and %HAS being writeable after they shouldn't be. And in both cases, a solution would require some messy trickery in Pure Perl, but would likely be much easier when in core.

I should probably have mentioned this when we talked :)

@stevan
Copy link
Owner

stevan commented Jan 15, 2017

Created one issue (#16) from this, but other issues/questions are actually no longer relevant because we removed ABSTRACT and CLOSED stuff.

@stevan stevan closed this Jan 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants