How would the compiler determine whether its safe that
Answer
occurs as a method parameter?
m
mekarthedev
03/30/2018, 7:46 PM
Simply by checking types. Unsafe is when method implementation is trying to e.g. set value of that parameter to a private property. The type of setter would be Nothing, which is not assignable from Answer.
mekarthedev
03/30/2018, 7:59 PM
See chapter "Detailed design"
b
benleggiero
03/31/2018, 3:10 PM
This probably wouldn't work for interfaces, external classes, and expect classes
m
mekarthedev
03/31/2018, 4:02 PM
@benleggiero its true. I couldn't find a way for this to work for overridable declarations. Thats why one of the proposed rules requires such methods to be final.