Questions about syntax decisions
bearophile
bearophileHUGS at lycos.com
Wed May 19 03:55:27 PDT 2010
F. Almeida:
> Now, in 2010, I've been giving D 2.0 a second chance and I'm happy
> with it. Strings, dynamic arrays and hash tables couldn't be easier
> to use and the option of metaprogramming presents way more
> possibilities than C++.
And there's a bit of possibility still to have AST macros in D3 (but recently they have got less probable).
> This can be confusing for people learning the language, especially
> if it's a first or second programming language.
I have not had problems with it, and people in D.learn seem to not complain about it. Currently there are far worse problems in D2 syntax.
> There are a number
> of symbols that are not used at all and could just as easily be
> used. Why not use "@"? The fact that D does not use the C macro
> preprocessor means that "#" is available, for example.
@ is now used for properties (currently there is the @property).
# is used only minimally. D tries to not add syntax that is valid C syntax with a different semantics.
> If the intention was to prevent people to turn "+"
> into concatenation for example, I'm afraid anybody really
> keen on doing so would still overload opAdd.
There was opCat plus language conventions. If programmers ignore them both, then they are stupid programmers. A language can't be designed to avoid really stupid errors like that, it's a wasted energy.
> As a side note, C++0x is going to add a new suffix operator to C++. This
> operator would be useful in its own right. Are there any plans to add a
> new opSuffix!("s") operator in D?
Quite probably it will not become part of D, I think Andrei doesn't like that. D has Foo!"xxx"(...) syntax.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list