Reddit: why aren't people using D?

Nick Sabalausky a at a.a
Sat Jul 25 01:55:46 PDT 2009


"Nick Sabalausky" <a at a.a> wrote in message 
news:h4eg2c$sn8$1 at digitalmars.com...
> "Walter Bright" <newshound1 at digitalmars.com> wrote in message 
> news:h4d9jt$1hq5$1 at digitalmars.com...
>> Steven Schveighoffer wrote:
>>> On Fri, 24 Jul 2009 14:10:59 -0400, Walter Bright 
>>> <newshound1 at digitalmars.com> wrote:
>>>> That's my problem with properties as a distinct syntax - they don't 
>>>> have distinct uses or behaviors.
>>>
>>> If you delineate what can be called how, then you elminate syntax 
>>> ambiguities from occurring, and eliminate bizarro cases of syntax.  The 
>>> difficulty is that the "human meaning" of a property is different than 
>>> the human meaning of a function.  To the compiler, they're all 
>>> functions, so you as the compiler writer aren't seeing that they are 
>>> different.  I think we all agree that writefln = "hi"; makes absolutely 
>>> no sense to a person.  But it makes complete sense to the compiler, 
>>> because it has no idea what the word "writefln" means to a person.
>>
>> But when I suggest a restriction on properties, I get complaints that 
>> someone might want to have them do what functions do. So I fail to see 
>> what rule distinguishes them from functions, even for people.
>>
>
> I'm not sure what restriction you're talking about, but here's the 
> difference:
>
> Function: Abstracted to a Verb ("write" "sort" "play" "decompress")
>
> Property: Abstracted to a Noun/Adjective ("position" "width" "color" 
> "turret" "ball")
>
> Variable: *Special case of Property*, where the *underlying storage* is 
> never lazy at all and is always exactly the same as what's presented to 
> the class's user.
>
>
> Here's another (psuedocode) way to describe the difference:
>
> Thing2D ball1, ball2;
>
> ball1.moveTo( [10, 7] ); // Function
> ball1.position = [10, 7]; // Property
>
> ball1.moveTo = [10, 7]; // Meaningless bullshit
> ball1.position( [10, 7] ); // Meaningless bullshit
>
> ball1.moveTo(ball2.position); // Sensible
> ball1.position = ball2.position; // Sensible
>
> ball1.moveTo(ball2.moveTo); // Meaningless bullshit
> ball1.position = ball2.moveTo; // Meaningless bullshit
>

With that ball/moveTo/position stuff, I should also clarify that for most of 
the code/languages across my programming career (save for the occasional 
cases of deliberate obfuscation and blatanty bad coding standards...oh, and 
asm of course ;) ) up until D, things have pretty much always worked like 
this:

IDENTIFIER PARENS: Verb
IDENTIFIER: Noun/Adjective

And especially now, that's becoming more and more the standard convention. 
(And yea, I'm sure there's a bunch of languages from the 80's and before 
that were completely different...)





More information about the Digitalmars-d mailing list