Skip to content

We should share BoundedClosures #3046

Closed
@floitschG

Description

@floitschG

Currently every implicitly bound closure (by getting a method) has its own class. This is not necessary if the methods have the same name.
We could furthermore store the method name as string in a generic BoundClosureClass.
Example:
class BoundClosure0 {
  var self, methodName; // methodName would not be accessible outside the class.
  BoundClosure0(this.self, this.methodName);

  call$0 = function() { return this.selfthis.methodName; }
}

Each arity (more precisely selector) would need its own BoundClosure class.

Activity

rakudrama

rakudrama commented on May 14, 2012

@rakudrama
Member

It would be great for debugging if the name of the closure was such that the name of the method appeared in the JasvaScript stack trace, e.g. Widget.item$bound_closure

I'm skeptical about the call this.selfthis.methodName being fast, but the entire closure class could be generated from relatively little metadata.

floitschG

floitschG commented on Aug 16, 2012

@floitschG
ContributorAuthor

This has been implemented a long time ago.


Added Fixed label.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @rakudrama@floitschG

        Issue actions

          We should share BoundedClosures · Issue #3046 · dart-lang/sdk