Re: property functions

2021-05-17 Thread Nick via Digitalmars-d-learn
with a public member. Thanks for the detailed explanation. I guess the wording of the warning seems strange to me, in that it recommends not to use property functions; but, in actuality (and regardless?), these functions are used a lot (even in the standard library; at least from what I&

Re: property functions

2021-05-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Monday, 17 May 2021 at 14:56:21 UTC, Steven Schveighoffer wrote: It used to be required, but we removed that requirement a long time ago. yeah i remember ElementType required it last time i checked but that was a while ago indeed it is all fixed now

Re: property functions

2021-05-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 5/16/21 11:47 AM, Adam D. Ruppe wrote: On Sunday, 16 May 2021 at 15:12:25 UTC, Nick wrote: Is this warning still valid? The @property thing doesn't do much. All it does is change typeof(a.prop) from function over to the return value of the function. (Which actually makes it required for t

Re: property functions

2021-05-16 Thread Paul Backus via Digitalmars-d-learn
On Sunday, 16 May 2021 at 15:47:55 UTC, Adam D. Ruppe wrote: On Sunday, 16 May 2021 at 15:12:25 UTC, Nick wrote: Is this warning still valid? The @property thing doesn't do much. All it does is change typeof(a.prop) from function over to the return value of the function. (Which actually make

Re: property functions

2021-05-16 Thread Adam D. Ruppe via Digitalmars-d-learn
On Sunday, 16 May 2021 at 15:12:25 UTC, Nick wrote: Is this warning still valid? The @property thing doesn't do much. All it does is change typeof(a.prop) from function over to the return value of the function. (Which actually makes it required for the range empty and front things!) But si

property functions

2021-05-16 Thread Nick via Digitalmars-d-learn
The [Property Functions](https://dlang.org/spec/function.html#property-functions) documentation reads: WARNING: The definition and usefulness of property functions is being reviewed, and the implementation is currently incomplete. Using property functions is not recommended until the

Re: with() statement doesn't want to work with property functions

2011-09-19 Thread Timon Gehr
ntrol how _bar is manipulated. I've lost the ability to use the with statement, which is a minor inconvenience. Is there a specific reason why with() should not be allowed to be used with property functions? This works fine: immutable Foo foo; with (foo) { } So I don't see why it sh

with() statement doesn't want to work with property functions

2011-09-19 Thread Andrej Mitrovic
to use the with statement, which is a minor inconvenience. Is there a specific reason why with() should not be allowed to be used with property functions? This works fine: immutable Foo foo; with (foo) { } So I don't see why it shouldn't work on property functions?

Re: Why non-@property functions don't need parentheses

2011-02-07 Thread %u
> It will be fixed at some point, but it hasn't been yet. Oh cool, all right; thanks!

Re: Why non-@property functions don't need parentheses

2011-02-06 Thread Simen kjaeraas
%u wrote: Hi, I was wondering, why are we allowed to omit parentheses when calling functions with no arguments, when they are not @properties? Is there a good reason for relaxing the language rules like this? This behavior is deprecated, but other features have had a higher priority tha

Re: Why non-@property functions don't need parentheses

2011-02-06 Thread Jonathan M Davis
ded so that it could be better controlled. However, while @property has been added, the compiler has yet to be changed to enforce that @property functions are called without parens and that non-@property functions are called with them. It will be fixed at some point, but it hasn't been yet. - Jonathan M Davis

Why non-@property functions don't need parentheses

2011-02-06 Thread %u
Hi, I was wondering, why are we allowed to omit parentheses when calling functions with no arguments, when they are not @properties? Is there a good reason for relaxing the language rules like this? Thanks!