Sealed classes - would you want them in D?

KingJoffrey KingJoffrey at KingJoffrey.com
Sat May 12 07:07:27 UTC 2018


On Saturday, 12 May 2018 at 06:38:16 UTC, rikki cattermole wrote:
>
> Now move Person into its own module.
> Boom errors.
>
> This is how module systems should work and everything is 
> working correctly :)
>
> You will not convince us otherwise.

If D treated functions, like it treats classes, then you could do 
this in D (see below) - and the argument to get around the 
problems this causes, would be to put each individual function in 
it's own module.

That is in essence, your proposed solution to the problem with 
class encapsulation in D.

============
module test;

void main() { goto wtf; }

void foo()
{

wtf: return;

     return;
}
==========


More information about the Digitalmars-d mailing list