[OT] Modules dropped out of C++17

Kagamin via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 9 08:06:07 PDT 2015


On Tuesday, 9 June 2015 at 14:05:40 UTC, Ola Fosheim Grøstad 
wrote:
> One of the arguments for having separate declarations and 
> definitions in C++ is that it provides better encapsulation 
> (which C++ breaks for templates and inlined methods).
>
> If you have full encapsulation you know that the declaration 
> holds. So "x.print()" means that the declaration for the type 
> of x includes "print()".

Well, if you have full encapsulation, then you don't have 
extension methods and consequently don't have this issue.

> True, but you can always wrap code in interfacing-references. I 
> use this deliberately in multi-threaded code, so that I avoid 
> calling the wrong methods on the wrong thread. E.g. 
> "multithreaded(someobject).clear()" and 
> "singlethreaded(someobject).clear()".

This doesn't look like full encapsulation if the type behavior is 
extended this way.


More information about the Digitalmars-d mailing list