Copying semantics: copying 'at' should not copy 'this'

Description

If the body of an at statement contains any reference to a member variable of the enclosing class instance, then the instance ('this') is deep-copied with all members, whether or not they are needed.

For example, in the following code both tinyField and hugeField are copied, even though only tinyField is referenced:

On my workstation, the execution time for this code is 283ms. By adding

just before the at statement, the execution time is reduced to 0.112ms because hugeField is no longer copied.

While it is possible for the programmer to work around, adding val myField == this.myField; for every field that is required, it would be much neater if the compiler could insert this automatically.

Yoav added:
It is a yet undecided language design issue. see XTENLANG-2466.

Environment

None

Status

Assignee

VijayV

Reporter

Imported User 41

Labels

None

Components

Fix versions

Affects versions

Priority

High
Configure