In C# ReadOnlyCollection<T> and ImmutableArray<T> are two completely different things for the exact reason.
zkmon 3 minutes ago [-]
The fact that it requires so much explanation, indicates the level of degradation in the reasoning ability of the audience. A value of a subtype shall deliver all of the expectations of its super type, because it is wearing both the hats of super type and sub type.
gus_massa 12 hours ago [-]
Yep, I wondered that for a few optimizations in Racket. It's harder than it looks, probably something about covariant or contravariant types, I gave up.
comrade1234 37 minutes ago [-]
Isn't NSMutableArray a subclass of NSArray in a few languages?
catoc 9 minutes ago [-]
Yes, that’s ObjC, any NSMutableArray is an NSArray (and an NSObject) - classes passed by reference.
Swift is completely different. Standard arrays are structures, always mutable - value types passed by value
Rendered at 06:21:40 GMT+0000 (Coordinated Universal Time) with Vercel.
In C# ReadOnlyCollection<T> and ImmutableArray<T> are two completely different things for the exact reason.
Swift is completely different. Standard arrays are structures, always mutable - value types passed by value