Skip to content

Support canonicalized closures #1652

Closed
Closed
@DartBot

Description

@DartBot

This issue was originally filed by @seaneagan


If a closure only captures scope names which are compile-time-constant, then it itself is compile-time-constant, and thus should always evaluate to the same exact closure object. This should be relatively easy to implement, since it can be accomplished by the compiler itself.

If a closure captures the same non-compile-time-constant variables on multiple evaluations, then each such evaluation could produce the same closure object. This would presumably require storing a table to map between captured variables, and the resulting closures. Thus, this might be a bit more difficult to implement, at least in JavaScript.

Metadata

Metadata

Assignees

Labels

area-languageDart language related items (some items might be better tracked at github.com/dart-lang/language).type-enhancementA request for a change that isn't a bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions