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

eval is evil (and undocumented) #1950

Open
benjie opened this issue Feb 8, 2024 · 2 comments
Open

eval is evil (and undocumented) #1950

benjie opened this issue Feb 8, 2024 · 2 comments
Assignees

Comments

@benjie
Copy link
Member

benjie commented Feb 8, 2024

Ref: https://discord.com/channels/489127045289476126/498852330754801666/1205068909787746304

So apparently the eval methods are completely undocumented... Good to know.

Yes; all the eval methods have a cost, but the more specific you can be the better. .evalHas(key) causes the plan to branch such that .evalHas('foo') will have two versions of the plan - one where foo is present, and one where foo is not present. (Compare to .eval() where each individual different object will result in a new plan.)

$__inputStep.evalHas(key): two plans
$__inputStep.eval(): almost infinite plans
$__inputStep.evalLength(): one plan for each length of the list
$__inputStep.evalIs(val): two plans (one where $__inputStep's value === val; and one where it doesn't)

@benjie
Copy link
Member Author

benjie commented Feb 8, 2024

@jemgillam I think details of this was in one of the sponsors only talks; perhaps you could extract it and add to the docs?

@benjie
Copy link
Member Author

benjie commented May 10, 2024

Actually, we're looking to maybe remove eval if we can... So let's put this on ice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🐭 Shrew
Development

No branches or pull requests

2 participants