# Proposal: Reflect.applyLegacy

**URL:** <https://es.discourse.group/t/proposal-reflect-applylegacy/1522>\
**Category:** 💡 Ideas\
**Tags:** proposal\
**Created:** [November 16, 2022, 10:11am UTC](https://es.discourse.group/t/proposal-reflect-applylegacy/1522 "2022-11-16T10:11:23Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![WebReflection](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/webreflection/32/248_2.png) [@WebReflection](https://es.discourse.group/u/WebReflection)\
**Post date:** [December 6, 2022, 1:48pm UTC](https://es.discourse.group/t/proposal-reflect-applylegacy/1522/7 "2022-12-06T13:48:49Z")

</div>

> [@mhofman](#):
>
> It all depends on what you consider "safe".

coming from [this current situation you were also involved](https://es.discourse.group/t/proposal-esx-as-core-js-feature/1511/78), I went ahead and tried to think about a way to cache a well known structure (of tokens) once and be able to create clones on demand in the fastest possible way.

[Here there's a benchmark](https://jsben.ch/QOk1m), and (not surprisingly) the result is that `Function` instrumented in a _super-safe_ way, basically putting a stringified _JSON_ in it and returning it each time, smokes any other standard solution ... plus, it's not _less safer_ by any mean.

 ![Screenshot from 2022-12-06 14-36-27](https://global.discourse-cdn.com/free1/uploads/es/original/2X/d/d71c04f13530987b11c9a46cbdaf5a5f8538b733.png)

> [@mhofman](#):
>
> Another approach would be the new [ShadowRealm API](https://github.com/tc39/proposal-shadowrealm), since you get to create a new set of intrinsics and evaluate code within that context.

Like it is for any proposal, I don't feel like exploring this approach, but also I don't think it would be faster than any solutions explored in the mentioned benchmark. Surely not faster to initialize, also considering that's an _async by design_ solution, hence it won't work on the fly for synchronous operations like I need to have/do in my case.

---

_[View the full topic](https://es.discourse.group/t/proposal-reflect-applylegacy/1522)._
