@property needed or not needed?

deadalnix deadalnix at gmail.com
Tue Nov 20 22:07:51 PST 2012


Le 20/11/2012 12:18, Timon Gehr a écrit :
> 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];
>

I conclude that @property should be limited to member function or UFCS 
calls. Otherwize, we get really weird stuffs going on.


More information about the Digitalmars-d mailing list