[Issue 9149] Disallow converting delegates to const
digitalmars-d-bugs at puremagic.com
Wed May 25 13:11:37 PDT 2016
--- Comment #14 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to timon.gehr from comment #13)
> Do you have an example where conversion to immutable for a strongly pure
> constructor leads to problems?
Basically, the example in comment 3, but with the delegate not being const.
> We can't (for class references, you never know whether some subclass might
> have a mutable delegate field). We need to do something else, but all
> options I have proposed so far are quite ugly (or become ugly when
> considering all the details required to make them work), so I'm open to
> different proposals.
Oh crap. Yeah that's a huge problem. The only thing I can think of is to
disallow const(A) if A has a non-const delegate. And disallow overriding any
const base functions.
More information about the Digitalmars-d-bugs