Should have @property

Salih Dincer salihdb at hotmail.com
Mon Jan 16 11:21:16 UTC 2023


On Monday, 16 January 2023 at 10:37:08 UTC, drug007 wrote:
> ...
> @property attribute makes your method be treated like a field, 
> not as a method by returning the method calling result, not the 
> method itself
> ...

There is also such a situation, but the last version was fixed:

```d
void main() {
   struct Index(T)
   {
     T value;

     this(T v) { value = v; };
     alias opCall this;

     @property opCall() inout {
       return value;
     }

   }

   enum one= Index!int(1)();
   int[one] a = 1;

   int[Index!int(2)()] b = 2;
   static assert(a.length < b.length);
}
```
SDB at 79


More information about the Digitalmars-d mailing list