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

Implement #30 #72

Merged
merged 9 commits into from
Apr 17, 2013
Merged

Implement #30 #72

merged 9 commits into from
Apr 17, 2013

Conversation

schwern
Copy link
Contributor

@schwern schwern commented Mar 25, 2013

This branch implements #30, turning the parsed parameter into an object, Method::Signatures::Parameter.

This isn't ready to be merged, MS::Parameter needs unit testing. Just putting it in here to begin the review process and see if anyone else wants to work on it.

It also slows down Method::Signatures load time and signature parsing by about 10%. I'm not terribly worried about that. This was a rote refactoring and that's just what you lose switching from hash lookups to method calls. Once the parameter parsing makes more sense I'm sure we can optimize it back and then some.

The work in Method::Signatures::Parser::split_parameter() has become
the Method::Sigantures::Parameter class.

This does not work or compile right now, but I have to go.

Remaning work...
* Change all the places which use the %sig hash to use the object.
* Actually make sure the new class compiles...
  * Using functions from MS::Parser
* Test the new class directly (test code coverage is very good)
Had to switch almost every attribute over to read-write because they're
setup during the BUILD step.  Unfortunately Moose enforces ro during
the BUILD step.  Could change it all to be in BUILDARGS but that
will complicate things and lose the advantage of having defaults
and types during the extensive BUILD stage.

Tests still failing extensively.  Time to start writing unit tests.
Since it's a completely different grammar, yadayada can't go through
the rest of the parsing and doesn't need to.  Return immediately.
MS::Parameter loads it.  The tests are moot.
@schwern
Copy link
Contributor Author

schwern commented Apr 8, 2013

@barefootcoder Could you review and merge this? It touches a lot of code and I'm afraid of it going stale.

@barefootcoder
Copy link
Contributor

I will absolutely try to hit this this weekend. The family is out of town, so I should have a few free moments. :-)

@barefootcoder
Copy link
Contributor

Well, tests fail on 5.8, 5.10, and 5.12. The error reporter sub apparently isn't getting all the way out of MS. Not sure why that would be diferent on <= 5.12 but okay on >= 5.14, but I'll look into it a bit deeper.

@barefootcoder
Copy link
Contributor

Okay, I can't see any potential problems with the code after thorough review. Let me just figure out if I can fix this bug with the error reporting then we should be good to merge.

apparently the call to new() for a Mouse object involves an eval in earlier Perl versions
this exposed a bug which I'm rather surprised wasn't discovered before
which is that the regex we build to determine what to skip demands something _inside_ one of the packages we specify
	we check both the method and the package against this
	when the package is exactly equal to the package we're checking against, that check fails
	happily, the method is still inside that package, so _that_ check succeeds
	except in this case the method was `(eval)`, so that failed too
	the solution was to allow exact package matches to succeed as well
also made the regex a bit nicer via /x while I was in there
also removed useless specification of Method::Signatures::Parser,
		since that's automatically caught by checking for Method::Signatures
@barefootcoder
Copy link
Contributor

Read the commit message for full gory details, but the good news is, it's fixed. I'll allow a bit of time for @schwern to comment if he so desires, then merge this perhaps tomorrow night.

schwern added a commit that referenced this pull request Apr 17, 2013
Implement #30, the parsed parameter is now an object, Method::Signatures::Parameter.
@schwern schwern merged commit 2a6d2ea into master Apr 17, 2013
@schwern
Copy link
Contributor Author

schwern commented Apr 17, 2013

@barefootcoder Thanks for fixing it on older perls.

@schwern schwern deleted the issue/30 branch April 17, 2013 19:23
@barefootcoder
Copy link
Contributor

So previously it would match "Method::Signatures::Foo" but not "Method::Signatures". Odd.

Yeah, weird, right?

Thanks for fixing it on older perls.

No worries. Glad to have this one put to bed.

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