-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
I'm proposing an attribute that helps with tracking shallow copies vs deep copies/ownership semantics. I just spent a while tracking down a bug caused by this.
C++ surfaces errors like this because you're likely to pass in references as parameters but have to use values as member variables, to you're more likely to cause a copy than dangling reference
class Foo {
private /*magic_attribute */_bars : readonly string[]
constructor(bars : readonly string[]){
this._bars = bars // This line now complains because I didn't call bars.slice(0)
}
}
magic_attribute named something like owning_copy? copy_mutables?
I'm working with TypesScript 3.6.4
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created