[Issue 17567] make shared methods callable on unshared objects (and covariant)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jun 28 12:57:41 PDT 2017


https://issues.dlang.org/show_bug.cgi?id=17567

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com

--- Comment #3 from Walter Bright <bugzilla at digitalmars.com> ---
(In reply to Martin Nowak from comment #2)
> It already seemed too simple to work out :).

We worked out the rules for implicit conversions (used for
covariance/contravariance) back when we came up with const/shared/etc. It's
best to derive these in isolation, and then apply them without needing to work
it out again.

(It's a lot like using the chain rule for derivatives. Derive the chain rule,
prove it's correct, then just apply it as a given.)

I've gone through the same process with scope conversions. I kept confusing
myself until I finally sat down and worked up a chart with the rules, convinced
myself that that was correct, and then just applied them without worrying about
it.

--


More information about the Digitalmars-d-bugs mailing list