Reddit: why aren't people using D?

Bill Baxter wbaxter at gmail.com
Mon Jul 27 15:16:30 PDT 2009


On Mon, Jul 27, 2009 at 3:01 PM, Andrei
Alexandrescu<SeeWebsiteForEmail at erdani.org> wrote:
> Nick Sabalausky wrote:
>>
>> "Andrei Alexandrescu" <SeeWebsiteForEmail at erdani.org> wrote in message
>> news:h4l4nr$20u0$4 at digitalmars.com...
>>>>
>>>> Sure. My point is that with using standard method definition syntax
>>>> there's no need for even looking over an example.
>>
>> So people are going to automagically just *know* to stick "opGet_" in
>> front of the name to make it a property?
>
> It's ONE rule to remember, and it blends perfectly with the rest of the
> language. Compare that with the bunch of arbitrary rules that you propose.
>
>>> PLUS:
>>>
>>> * need to remember that get is not followed by ()
>>>
>>
>> 1. That's trivial to remember.
>
> No. "Trivial to remember" is far from enough. You need to justify why
> there's anything I need to remember in the first place.
>
>> 2. Ok, so we can stick a () after get.
>
> Ok, so it's an arbitrary rule. Why exactly is it necessary?
>
>>> * need to remember that set does not take a type like any other function,
>>> just an identifier
>>>
>>
>> set(auto v)
>> Problem solved.
>
> Yah, "solved" with more arbitrary syntax. I love this.
>
>> Plus with both of the above, you're seem to be using arguments against a
>> specific decicated property syntax as as arguments against dedicated
>> property syntaxes in general.
>>
>>> * need to remember that there is no () after width
>>
>> Why in the world would there be? It's not a function.
>
> Well I don't know what it is, so there might as well be some parens in
> there. It's all arbitrary after all. Syntax upon syntax upon syntax. Why do
> we need it?
>
> This looks like switch all over again :o).

Some other things to consider.  Here's what Qt's property syntax looks like:

    Q_PROPERTY( type name READ getFunction [WRITE setFunction]
    [RESET resetFunction] [DESIGNABLE bool]
    [SCRIPTABLE bool] [STORED bool] )


So this:
    Q_PROPERTY( QString Id READ getId WRITE setId );

defines a property named "Id" of type QString which you read with
getId() and write with setId().

That's also kinda similar to Python's basic pre-2.4 mechanism (you
write normal functions then mark them as part of a property with a
separate line of code).

The main thing that interests me here is the other stuff in Qt's
props: RESET, DESIGNABLE, SCRIPTABLE, and STORED.

Why does Qt need these and what does that imply for D?

--bb



More information about the Digitalmars-d mailing list