Reddit: why aren't people using D?

Steven Schveighoffer schveiguy at yahoo.com
Mon Jul 27 10:31:25 PDT 2009


On Mon, 27 Jul 2009 13:23:42 -0400, Bill Baxter <wbaxter at gmail.com> wrote:

> On Mon, Jul 27, 2009 at 7:13 AM, Steven
> Schveighoffer<schveiguy at yahoo.com> wrote:
>> On Fri, 24 Jul 2009 17:40:37 -0400, Walter Bright
>> <newshound1 at digitalmars.com> wrote:
>>
>>> Ary Borenszweig wrote:
>>>>
>>>> Maybe what scares Walter is a whole new syntax for properties.
>>>
>>> It doesn't scare me. It's trivial to add more syntax.
>>>
>>> It's just that D is complex enough - there needs to be some very good
>>> reasons for adding more syntax that has apparently zero semantic  
>>> information
>>> that would be different from the usual function syntax.
>>
>> OK, so you don't like the idea of adding dedicated properties.
>>
>> What is *your* solution to forbidding abuses like this:
>>
>> writefln = "hi";
>>
>> ???
>>
>
> I think his suggestion was the Java-style approach -- special naming
> convention for get/set functions:
>
> int opGet_foo() { return foo_; }
> void opSet_foo(int foo) { foo_ = foo; }
> private:
> int foo_;

Really?  I got the impression that he does not think properties warrant  
any kind of special syntax.

If that's the solution it's ok with me, the only issue is name collision  
(as others have mentioned):

int opGet_foo()
int foo;

must be forbidden.  This is different from other opX operators since the  
true names of those operators cannot be symbols, and therefore could never  
have collisions.

-Steve



More information about the Digitalmars-d mailing list