Sealed classes - would you want them in D?

rikki cattermole rikki at cattermole.co.nz
Sat May 12 07:19:47 UTC 2018


On 12/05/2018 7:07 PM, KingJoffrey wrote:
> 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;
> }
> ==========

I see no problem.

onlineapp.d(1): Error: label wtf is undefined


More information about the Digitalmars-d mailing list