Skip to content

Commit

Permalink
updating comments to reflect lack of BeginLift
Browse files Browse the repository at this point in the history
  • Loading branch information
barefootcoder committed Nov 4, 2012
1 parent 3f11955 commit 06e50a2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/Method/Signatures.pm
Expand Up @@ -714,7 +714,7 @@ sub inject_if_block
# Named function compiled at BEGIN time
if( defined $name && $self->_do_compile_at_BEGIN ) {
# Devel::Declare needs the code ref which has been generated.
# Forunately, "sub foo {...}" happens at compile time, so we
# Fortunately, "sub foo {...}" happens at compile time, so we
# can use \&foo at runtime even if it comes before the sub
# declaration in the code!
$before = qq[\\&$name; sub $name $attrs ];
Expand Down
18 changes: 4 additions & 14 deletions lib/Method/Signatures/Modifiers.pm
Expand Up @@ -192,21 +192,11 @@ sub import
}


# The code_for routine for Method::Signatures just takes the code from
# Devel::Declare::MethodInstaller::Simple (by calling SUPER::code_for) and uses BeginLift to promote
# that to a compile-time call. However, for modifiers, we can't do that at all:
# Method::Signatures doesn't have a code_for routine; it just passes through directly to
# Devel::Declare::MethodInstaller::Simple. But DDMIS::code_for creates a sub, which is entirely
# different from creating a method modifier. We need all different code.
#
# * The code from DDMIS::code_for creates a sub, which is entirely different from creating a
# method modifier. We need all different code.
#
# * We can't use BeginLift here, because what it does is cause the method modifier to be created
# first, before things like "extends" and "with" have had a chance to run. That means that
# the method you're trying to create a modifier for might not even exist yet, because it comes
# from a superclass or role (in fact, that's the most likely case; you don't typically need a
# modifier on a method in your own class).
#
# So we need a whole different code_for. We'll need to return a sub which does the following
# things:
# Our code_for will need to return a sub which does the following things:
#
# * Figures out the metaclass of the class we're processing.
#
Expand Down

0 comments on commit 06e50a2

Please sign in to comment.