the cases where the interface explicitly wants that any and all 
derived classes should have no side-effects   

It is currently possible in CPP. Declaring a base class interface method as const ensures that a derived overridden method won't have side effects,
however that is in contradiction to my argument, claiming that it is not necessary nor necessarily correct.

Occasionally that leads to reluctantly declare variables in derived classes as mutables or use const cast.

Backward compatibility should be preserved, compiling an existing code should result in identical results having this new 'mutable' keyword opted-in.



On Sat, 21 Sep 2019 at 22:52, Thiago Macieira via Std-Discussion <std-discussion@lists.isocpp.org> wrote:
On Friday, 20 September 2019 20:50:56 PDT Lior Lahav via Std-Discussion wrote:
> It would be logical that a pure abstract class const correctness would be
> decoupled from an implementation and should not dictate whether derived
> class should have side effects.

Except for the cases where the interface explicitly wants that any and all
derived classes should have no side-effects. How should one write such a
declaration (in the base class) that guarantees this contract?

--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel System Software Products



--
Std-Discussion mailing list
Std-Discussion@lists.isocpp.org
https://lists.isocpp.org/mailman/listinfo.cgi/std-discussion