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

Change the usage of tokens for lazy evaluation #736

Closed
eladb opened this issue Sep 18, 2018 · 4 comments
Closed

Change the usage of tokens for lazy evaluation #736

eladb opened this issue Sep 18, 2018 · 4 comments
Labels
feature-request A feature should be added or improved.

Comments

@eladb
Copy link
Contributor

eladb commented Sep 18, 2018

Instead of new Token(() => value), since the use case for using lazy evaluation is only for synthesis, maybe what we can do is actually provide a method in Construct, which will also give us the ability to associate the token with the construct:

new QueueResource(this, 'Resource', {
  visibilityTimeout: this.lazyEval(() => 122)
});

See #712 (comment)

@rix0rrr
Copy link
Contributor

rix0rrr commented Sep 18, 2018

Something like

Value.lazy(() => xxx)

might even be better. But I'm having trouble thinking of a good class name to substitute for Value there.

@eladb
Copy link
Contributor Author

eladb commented Sep 19, 2018

The reason I was thinking to tie this into the Construct is that the mental model is the this is a value that's going to be evaluated during synthesis (under the hood it might use something like Value.lazy but when I read CDK code, it actually makes sense to be more explicit about when is this value going to be resolved.

How about this.synthesisEval(() => 122) or this.synthEval(() => 'hello').

Thoughts?

@rix0rrr
Copy link
Contributor

rix0rrr commented Sep 25, 2018

I'm not sure the more complex name is worth it in this case.

@srchase srchase added feature-request A feature should be added or improved. and removed enhancement labels Jan 3, 2019
@eladb
Copy link
Contributor Author

eladb commented Sep 8, 2019

Resolved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

3 participants