Closed felixangell closed 8 years ago
Take the example here, we have a variable that is made mutable, though the compiler moans:
error: [file:30:2] Cannot assign value to immutable access f.path = path; ^ error: [file:31:2] Cannot assign value to immutable access f.handle = C::fopen(f.path.location);
Though in the context of the function that code is in, the path that we assign is mutable, as is the f variable.
f
You have an immutable pointer and thus cannot assign the field on the struct. But as luck would have it you can cast an immutable pointer to a mutable one because yolo
Bless :heart:
Take the example here, we have a variable that is made mutable, though the compiler moans:
Though in the context of the function that code is in, the path that we assign is mutable, as is the
f
variable.