@property - take it behind the woodshed and shoot it?

Adam Wilson flyboynw at gmail.com
Thu Jan 24 14:17:16 PST 2013


On Thu, 24 Jan 2013 14:04:02 -0800, Andrei Alexandrescu  
<SeeWebsiteForEmail at erdani.org> wrote:

> On 1/24/13 4:56 PM, Adam Wilson wrote:
>>> Simplicity is clearly good, but there's something to be said about
>>> those warts in chained calls. The UFCS-enabled idioms clearly bring a
>>> strong argument to the table, there's no ignoring it.
>>>
>>> Andrei
>>
>> Then @property needs to be fixed such that optional parens don't effect
>> it one way or the other. Removing the concept of properties and making
>> functions that look like properties through optional parens is a very
>> poor (and lazy) solution. As Mr. Ruppe pointed out, properties are DATA,
>> and functions do stuff. That statement alone is an excellent argument
>> for clearly delineating which is which... Properties are not functions.
>
> I'm not all that convinced, and it's easy to get wedged into a black vs  
> white position that neglects many subtleties. Properties are DATA, well  
> except when you need to pass fields by reference etc. at which point the  
> syntactic glue comes unglued.

... wat? I fail to see what byref has to do with this. It shouldn't matter  
what the data is to the compiler as both are built on top of functions,  
the compiler just enforces different calling syntax for each. If this is a  
problem for properties then it is a problem for functions to...

Because from a compiler POV Data.Property.FieldOfReference; is no  
different than Data.Function().FieldOfReference;
But from a syntax standpoint the difference important because  
Data.Property(InRef, Count).FieldOfReference; is utterly nonsensical where  
Data.Function(InRef, Count).FieldOfReference; is perfectly legitimate.

> There's been a lot of strong positions years ago about functions vs.  
> procedures, statements vs. expressions, or even (the glorious 60s!)  
> in-language I/O primitives vs. I/O as library facilities. Successful  
> languages managed to obviate such dichotomies.
>
>
> Andrei


-- 
Adam Wilson
IRC: LightBender
Project Coordinator
The Horizon Project
http://www.thehorizonproject.org/


More information about the Digitalmars-d mailing list