September 14, 2022
On Wednesday, 14 September 2022 at 22:38:34 UTC, Ali Çehreli wrote:
> I think I heard about supporting the following as well, which is currently missing:
>
>     foo.data++;

Yeah, these and

@property void delegate() foo() { ... }

obj.foo(); // should call the delegate, not be a no-op


are the two things I still hold out hope for @property to be useful.

But it has been like 11 years and it has never worked. I don't expect it ever will.
September 15, 2022

On Wednesday, 14 September 2022 at 19:20:04 UTC, Rikki Cattermole wrote:

>

Recently Walter has been wanting to remove language features that don't need to be kept to simplify the language.

It seems everybody agrees that binary literals are not a worthy candidate for removal, but one thing that I kept thinking about was @property. As far as I know, hardly anyone actually uses its semantic behaviors, and the ones that it does have which are incomplete are special cases that don't benefit us all that much.

I was going to post this yesterday, but it turns out I am not alone in thinking this can be removed safely (can be swapped to a UDA to prevent code breakage without any language additions).

So, who uses @property semantics?

https://dlang.org/spec/function.html#property-functions

I use it (though in my case, the code would still work the same even without @property). Personally, I think it should be kept, because of ref properties, that could possibly be used to restrict the value-range of members.

September 15, 2022
On 15/09/2022 12:34 PM, Ruby The Roobster wrote:
> I use it (though in my case, the code would still work the same even without @property).

Okay, so you don't use the semantics provided by @property, a UDA would still allow your code to work (see link for semantics)?
September 15, 2022
On Thursday, 15 September 2022 at 00:38:54 UTC, rikki cattermole wrote:
>
> On 15/09/2022 12:34 PM, Ruby The Roobster wrote:
>> I use it (though in my case, the code would still work the same even without @property).
>
> Okay, so you don't use the semantics provided by @property, a UDA would still allow your code to work (see link for semantics)?

I mean that because properties don't take any arguments, such a function could be called using UFCS, and it would act the same as if it were marked @property.
September 15, 2022
On 15/09/2022 1:31 PM, Ruby The Roobster wrote:
> On Thursday, 15 September 2022 at 00:38:54 UTC, rikki cattermole wrote:
>>
>> On 15/09/2022 12:34 PM, Ruby The Roobster wrote:
>>> I use it (though in my case, the code would still work the same even without @property).
>>
>> Okay, so you don't use the semantics provided by @property, a UDA would still allow your code to work (see link for semantics)?
> 
> I mean that because properties don't take any arguments, such a function could be called using UFCS, and it would act the same as if it were marked @property.

Okay good good, you are only using the syntax that is what we needed to know, thanks!
September 15, 2022

On Wednesday, 14 September 2022 at 19:20:04 UTC, Rikki Cattermole wrote:

>

So, who uses @property semantics?

How can we use it if it is not implemented?

struct S
{
    void opCall() {}
    void opAssign(S s) {};
}

@property ref S foo();
foo(); // doesn't do what's expected
foo = S(); // same

@property void delegate() foo();
foo(); // same

@property ref int foo();
foo++;

etc

September 15, 2022

On Thursday, 15 September 2022 at 05:20:53 UTC, Max Samukha wrote:

>

@property ref int foo();
foo++;

Without 'ref'

September 15, 2022

On Wednesday, 14 September 2022 at 19:20:04 UTC, Rikki Cattermole wrote:

>

Recently Walter has been wanting to remove language features that don't need to be kept to simplify the language.

It seems everybody agrees that binary literals are not a worthy candidate for removal, but one thing that I kept thinking about was @property. As far as I know, hardly anyone actually uses its semantic behaviors, and the ones that it does have which are incomplete are special cases that don't benefit us all that much.

I was going to post this yesterday, but it turns out I am not alone in thinking this can be removed safely (can be swapped to a UDA to prevent code breakage without any language additions).

So, who uses @property semantics?

https://dlang.org/spec/function.html#property-functions

I use it extensively and have since I can remember for all my projects. Would really hate having to go through all my projects to remove it and fix whatever bugs/errors that will for sure creep up from it.

September 15, 2022

On Wednesday, 14 September 2022 at 19:20:04 UTC, Rikki Cattermole wrote:

>

So, who uses @property semantics?

https://dlang.org/spec/function.html#property-functions

I don't, except maybe for consistency with existing code when working on a common codebase with other people. I wouldn't mind it going.

September 15, 2022
On Wed, Sep 14, 2022 at 07:20:04PM +0000, Rikki Cattermole via Digitalmars-d wrote: [...]
> So, who uses @property semantics?
> 
> https://dlang.org/spec/function.html#property-functions

Not me.  In the past I only did it to satisfy Phobos range APIs, but today Phobos no longer requires @property on ranges, so it's basically useless as far as I'm concerned.


T

-- 
Marketing: the art of convincing people to pay for what they didn't need before which you fail to deliver after.