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 Proxy built-in object #1300

Closed
Razican opened this issue May 31, 2021 · 8 comments · Fixed by #1664
Closed

Implement Proxy built-in object #1300

Razican opened this issue May 31, 2021 · 8 comments · Fixed by #1664
Assignees
Labels
builtins PRs and Issues related to builtins/intrinsics enhancement New feature or request
Milestone

Comments

@Razican
Copy link
Member

Razican commented May 31, 2021

ECMASCript feature
ECMAScript allows using the Proxy object to re-define operations for normal objects, doing a "proxy" functionality. You can check how this works in the MDN, and in the specification.

Example code

const target = {
  message1: "hello",
  message2: "everyone"
};

const handler2 = {
  get: function(target, prop, receiver) {
    return "world";
  }
};

const proxy2 = new Proxy(target, handler2);

console.log(proxy2.message1); // world
console.log(proxy2.message2); // world

Tips for implementation
You can see #1033 to get ideas on how to implement the Proxy object. Some functionality (since it requires intercepting calls to other objects) might require some complex work. Feel free to ask for mentoring.

@Razican Razican added enhancement New feature or request builtins PRs and Issues related to builtins/intrinsics labels May 31, 2021
@Razican Razican added this to the v0.13.0 milestone May 31, 2021
@teymour-aldridge
Copy link
Contributor

I'm interested in working on this.

@Razican
Copy link
Member Author

Razican commented Jun 25, 2021

I'm interested in working on this.

I assigned it to you, let us know if you'd like any help!

@jedel1043
Copy link
Member

jedel1043 commented Aug 27, 2021

@teymour-aldridge are you still working on this? The object API changed considerably to be more friendly when creating new exotic objects, maybe you could check it out if you have been having trouble implementing proxy objects!

@raskad raskad assigned raskad and unassigned teymour-aldridge Sep 15, 2021
@raskad
Copy link
Member

raskad commented Sep 15, 2021

Changed the assignment to me, as I did some testing and got a working prototype. @teymour-aldridge If you already did some work on this let me know!

@teymour-aldridge
Copy link
Contributor

No worries; sorry, I was beleaguered with other things :)

@raskad raskad modified the milestones: v0.13.0, v0.14.0 Sep 25, 2021
@Razican
Copy link
Member Author

Razican commented Oct 5, 2021

@raskad, how is this going?

@raskad
Copy link
Member

raskad commented Oct 5, 2021

@raskad, how is this going?

I've got the full implementation ready. It just needs #1583 to merge

@jedel1043
Copy link
Member

jedel1043 commented Oct 11, 2021

Merged #1583, should unblock this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins PRs and Issues related to builtins/intrinsics enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants