Reddit: why aren't people using D?
Bill Baxter
wbaxter at gmail.com
Fri Jul 24 14:56:21 PDT 2009
On Fri, Jul 24, 2009 at 2:44 PM, Walter
Bright<newshound1 at digitalmars.com> wrote:
> Michiel Helvensteijn wrote:
>>
>> That's just a few reasons right there. D's properties lack elegance and
>> they
>> lack potential.
>
> Let's start with:
>
> 1. What is a property?
"""
Properties are members that provide a flexible mechanism to read,
write, or compute the values of private fields. Properties can be used
as though they are public data members, but they are actually special
methods called accessors. This enables data to be accessed easily
while still providing the safety and flexibility of methods.
"""
-- thanks MSDN
> 2. How is that different from, say, a pure function?
Properties behave semantically like fields, but are implemented like
functions enabling them to do arbitrary calculation on the side when
the field is read from or written to.
Pure functions are totally different. First, half of the property
syntax is about mutating a state. That's obviously not pure. And on
the get() side its returning the value of a mutable state, so again,
not pure.
--bb
More information about the Digitalmars-d
mailing list