@property needed or not needed?

Timon Gehr timon.gehr at gmx.ch
Tue Nov 20 12:18:42 PST 2012


On 11/20/2012 02:49 PM, Regan Heath wrote:
> On Tue, 20 Nov 2012 13:26:15 -0000, Adam D. Ruppe
> <destructionator at gmail.com> wrote:
>
>> On Tuesday, 20 November 2012 at 12:44:44 UTC, Jacob Carlborg wrote:
>>> Should this be allowed for functions that isn't marked with @property:
>>>
>>> foo = 3;
>>
>> Yes. We should *only* be changing the way @property is implemented.
>> (Namely, actually implementing it!)
>>
>> Don't want to break existing code. The new changes must be opt in.
>
> Usually I'd agree but this is a case of a wart we should just remove
> IMO.  The fix for breaking cases is simple, add @property.
>
>> If there's both an @property setter and a regular function, the
>> property should be used here.
>
> Agreed.  But it's waay clearer whats going on if @property is required
> to call functions using this syntax.
>
> R
>

Not really.

@property T front(T)(T[] arr) { return arr[0]; }

[1,2,3,4].front;

front = [1,2,3,4];



More information about the Digitalmars-d mailing list