|
|
|
|
|
by aatd86
37 days ago
|
|
You are approaching the issue but from the other direction :)
It is indeed subtle.
It could be solvable though if someone wanted to change the current behavior, in a forward compatible way. Hint: "Don't use pointers at all" is the requirement that you would have to relax.
That means that you cannot know whether a pointer is safe or not to be used from within an interface. Conservatively, that means that every nil pointer in interfaces are unsafe. Which means we should either have a way to check for nil pointers (typed or untyped) in interfaces or assert that an interface value cannot contain a nil pointer. (requires definite assignment analysis) Actually have implemented the nil checking migration part as a POC but seems that it requires the assertion part to be tractable... That is a bit more work. |
|