Open alex-vasenin opened 6 years ago
Thanks Alexander, you're really up-to-date with these issues I have a hard time to follow. I remember wondering whether a "filling-empty-space" default implementation would be a good idea or not. It is not. I am focused on other things right now. If you have an idea on how to get around this problem... well, of course, I'm sure you'll submit it here. Thanks again!
Just checked right now, and this is not yet fixed. Damn.
I would like to keep the default implementation. The solution I see for now is to switch from a var to a func. But this will break APIs.
Oups, no. Funcs won't work either, according to https://bugs.swift.org/browse/SR-103
print((gasGiants[1] as! Saturn).magnitude.value)
works, but this is not satisfactory.
Saturn magnitude is still buggy in some cases:
This is one of the very few cases where Swift language itself falls short. Saturn's object is both
Planet
andSaturn
. Planet has it's ownmagnitude
as default implementation ofIlluminatedFraction
protocol. Saturn has it's ownmagnitude
as computed property. Due to static dispatch Swift calls wrong implementation formagnitude
in some cases. More info in SR-103.