Upvar

Noun · Development

Definitions

  1. A variable referenced inside a closure or nested function that is defined in an enclosing scope. The compiler must decide whether to capture it by value, by reference, or by move.

    In plain English: A variable from an outer function that gets used inside an inner function or closure, which the compiler has to figure out how to share between them.

    Example: "The closure captures count as an upvar — make sure it's moved, not borrowed, if the closure outlives the scope."

Related Terms