On Friday, 6 January 2023 at 15:31:09 UTC, Salih Dincer wrote:
If you don't want to get the above output you should use the previous example. But don't forget to connect alias and opCall. For example, you can use @property in version 2.0.83 without all the fanfare.


I forgot one thing: if you implement getter/setter like below use inout as well.

Actually, this must be a bit of a bug and neither I nor anyone else reported it! Ok they will say don't use @property. But this time the screen output will be like typeid. If you don't want that to happen, you have to use inout in getter functions.

```d
struct Funy(T)
{
  this(T x) {
    value = x;
  }

  T value;
  alias opCall this;

  @property:
  T opCall(T n)
  {
    return value = n;
  }

  T opCall() inout
  {
    return value;
  }
}
```

SDB@79


Reply via email to