Using closure in function scope to make "real" private class members

Max Samukha maxsamukha at gmail.com
Wed Jun 8 13:56:11 UTC 2022


On Wednesday, 8 June 2022 at 13:14:43 UTC, Ola Fosheim Grøstad 
wrote:
> On Wednesday, 8 June 2022 at 12:49:27 UTC, Max Samukha wrote:
>> For example, 'this' as the name for constructors/destructors 
>> is an improvement over C++.
>
> I dislike the reuse of terminology for different concepts, so I 
> prefer «constructor» like in TypeScript,

It is still 'constructor' and not a different name every time.

> although I guess the C++ solution makes sense because you can 
> conceptualize it as a call to function with the same name as 
> the class.

Yes, but when the name is used in the context of that class, it 
is redundant.

>
> Anyway it is possible to create a parser/grammar without 
> reserving so many keywords (or reusing them). I don't think 
> there is a good reason for having "@safe" and "@pure", the 
> grammar ought to be unambiguous with "safe" and "pure" without 
> making them keywords.




More information about the Digitalmars-d mailing list