Adding a new design constraint to D
Max Samukha
maxsamukha at gmail.com
Tue Jun 14 16:33:10 UTC 2022
On Tuesday, 14 June 2022 at 13:49:30 UTC, Ola Fosheim Grøstad
wrote:
>
> It isn't necessarily through a different path unless you think
> that Bar is cloaking Foo, basically redoing everything that is
> Foo.
D encourages me to think about it as being similar to 'alias
this', which seems to behave differently:
```d
module a;
import b;
struct Foo
{
private int _c;
}
void foo(Bar b)
{
b._c = 1; // passes, to Mike's and my surprise
}
void main()
{
}
```
```d
module b;
import a;
struct Bar
{
Foo foo;
alias foo this;
}
```
More information about the Digitalmars-d
mailing list