You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Problem:
Closure-referenced variables cannot be copied. Any closure-reference will forever refer to the same variable in the same memory location. This prevents deep copying of any KOSDelegate, or structure that contains a KOSDelegate.
If the closure-referenced variable is immutable (i.e. never changed after the closure is established), this is not a problem in practice. However, if the variable that is deep copied along with the KOSDelegate, the KOSDelegate will still refer to the original variable, not the copy.
As a workaround, only use closures to refer to immutable variables if the KOSDelegate could possibly be cloned().
The solution seems to be impossible in Kerboscript alone. Perhaps by modifying the .ksm byte-code? Perhaps by adding deep-copy semantics to Kerboscript itself that makes this work? I think that Rust can re-bind closures, for example.
The text was updated successfully, but these errors were encountered:
Problem:
Closure-referenced variables cannot be copied. Any closure-reference will forever refer to the same variable in the same memory location. This prevents deep copying of any KOSDelegate, or structure that contains a KOSDelegate.
If the closure-referenced variable is immutable (i.e. never changed after the closure is established), this is not a problem in practice. However, if the variable that is deep copied along with the KOSDelegate, the KOSDelegate will still refer to the original variable, not the copy.
As a workaround, only use closures to refer to immutable variables if the KOSDelegate could possibly be cloned().
The solution seems to be impossible in Kerboscript alone. Perhaps by modifying the .ksm byte-code? Perhaps by adding deep-copy semantics to Kerboscript itself that makes this work? I think that Rust can re-bind closures, for example.
The text was updated successfully, but these errors were encountered: