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

RFC 279: Newinstance with closures #1

Merged
merged 2 commits into from
Nov 13, 2013
Merged

RFC 279: Newinstance with closures #1

merged 2 commits into from
Nov 13, 2013

Conversation

thekid
Copy link
Member

@thekid thekid commented Nov 12, 2013

This pull request implements xp-framework/rfc#279 and adds closure support to newinstance.

Old

$handler= newinstance('lang.reflect.InvocationHandler', array(), '{
  public $invocations= array();
  public function invoke($proxy, $method, $args) {
    $this->invocations[$method."_".sizeof($args)]= $args;
  }
}');

New

$handler= newinstance('lang.reflect.InvocationHandler', array(), array(
  'invocations' => array(),
  'invoke' => function($self, $proxy, $method, $args) {
    $self->invocations[$method.'_'.sizeof($args)]= $args;
  }
);

thekid added a commit that referenced this pull request Nov 13, 2013
RFC 279: Newinstance with closures
@thekid thekid merged commit 5d5fa48 into master Nov 13, 2013
@thekid thekid deleted the rfc-279 branch November 13, 2013 12:08
@thekid thekid modified the milestone: 6.0.0 May 6, 2014
thekid added a commit that referenced this pull request Oct 6, 2020
@thekid thekid mentioned this pull request Mar 14, 2021
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant