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
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
The text was updated successfully, but these errors were encountered:
Ah, sorry for not seeing the template (thought it was just boilerplate about trying to find dupes).
Looking at the context bug, ownership seems well litigated. How about something that tracks frozenness? That would get the immutability check I’m really trying to get at
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
The text was updated successfully, but these errors were encountered: