On Wednesday, 7 November 2012 at 08:36:49 UTC, Jacob Carlborg
wrote:
On 2012-11-06 22:53, Walter Bright wrote:
C++11 has had problems adding new keywords, as about every
identifier
somewhere has been used by someone's C++ source code, and they
don't
want to break existing code. So C++11 winds up with awful
things like
"decltype".
Just create a new attribute, call it "builtin" or something
similar, which takes attributes as arguments, i.e.
@builtin(shared) int a;
@builtin(property) int b;
I'm not suggesting that we should change the existing @shared
and @property, I just used them as an example.
I honestly don't get why we keep reinventing the concept of
namespaces.
I agree with Jonathan regarding the identifier look-up rules in D.
"std.algorithm.find" really should be *the default* unless the
user specifically aliases that to "find" whereas now we have the
exact opposite. But even without this we still should use D's
already existing namespace solution - *the module system*. We
should take a lesson from other platforms such as Java and .NET
where everything is neatly organized. Let's stop this global
identifiers nightmare!
On that note, here's some things we *should not do*:
- put unrelated random stuff in object.d
- add more redundant ways to define namespaces such as
__identifier, builtin(identifier), @attribute(identifier),
@identifier, etc, etc..
- add more @keywords because they conflict with global
identifiers.
- have _huge_ single modules in Phobos that contain everything
and ythe kitchen sink. I still hate with passion the
"std.algorithm" "module". It's like opening a shop called "A
Shop" or naming a newspaper "Newspaper".
Proper organization is not inherently evil and we should not
complicate the language design to compensate our current
sloppiness.