January 15

On Sunday, 14 January 2024 at 22:49:31 UTC, Paul Backus wrote:

>

In C++, this approach to language design has lead to having seven different types of initialization, among other disasters. If we follow the same path with D, we will end up in the same place.

In fact, the initialization of C++is better than that of D.

//C++;
A a{1,2};

//VS,D:
A a=A(1,2);

Users don't care about details!

January 15

On Sunday, 14 January 2024 at 21:27:44 UTC, Steven Schveighoffer wrote:

>

I'm going to propose something that furthers the baggage of enum, but that is the tool we currently have... Happy to think about better syntax. But why not just:

void foo(T)(T x, enum string s)
{
   pragma(msg, s); // s is compile-time
}

void main(string[] args)
{
   foo(1, "hi"); // ok
   foo(1, "hello"); // ok, but a different instantiation
   foo(1, args[1]); // error, second argument must be compile time
}

Unbeknownst to me, Quirin F. Schroll has already created a pretty robust DIP that is ready for proposing, describing basically exactly what I was proposing, with all the hairy details worked out.

I apologize for not recognizing this, and hope that this DIP is considered and accepted!

This indeed would enable a much simpler mechanism for the SI proposals to be dealt with at compile time.

-Steve

January 15

On Monday, 15 January 2024 at 16:49:24 UTC, Steven Schveighoffer wrote:

>

Unbeknownst to me, Quirin F. Schroll has already created a pretty robust DIP that is ready for proposing, describing basically exactly what I was proposing, with all the hairy details worked out.

I apologize for not recognizing this, and hope that this DIP is considered and accepted!

This indeed would enable a much simpler mechanism for the SI proposals to be dealt with at compile time.

-Steve

I just want to add that C++20 went down a similar route... yet using auto.
https://en.cppreference.com/w/cpp/language/function_template#Abbreviated_function_template

Not as flexible as Quirins idea yet a little simpler. I don't mind either way... but could be good to know it exists before you decide on something.

January 15

On Monday, 15 January 2024 at 03:43:04 UTC, zjh wrote:

>

In fact, the initialization of C++is better than that of D.

//C++;
A a{1,2};

//VS,D:
A a=A(1,2);

The problem with C++ is that the second syntax also works but does not do the same thing, which is just awful.

January 16

On Monday, 15 January 2024 at 18:01:33 UTC, bomat wrote:

>

The problem with C++ is that the second syntax also works but does not do the same thing, which is just awful.

It's just a few constructors, it's easy to distinguish.
And D even disabled the default constructor, I really don't understand why, it's completely self binding.

January 16

On Tuesday, 16 January 2024 at 00:29:20 UTC, zjh wrote:

>

It's just a few constructors, it's easy to distinguish.

It's a mess.

Look, I don't want to derail this discussion, I cannot even judge the usefulness of the proposal, I just want to whole-heartedly agree with Paul Backus about the point that you can overdo it with adding bells and whistles, especially when you never deprecate (let alone remove) old stuff because of backwards compatibility.
And if C++ is not a great example for that, I don't know what is.
It's not "just a few constructors". At this point it's absolutely everything. Everything can be done in 7 different ways, but of course with tiny nuances that nobody can understand anymore. The logic by which a C++ compiler will generate default ctors and copy-operators based on which ones you have defined manually is literally quantum mechanics: look at the system too hard and you will change its behavior. Asylums are filled with people who tried to understand what actually happens when a C++ function returns a value.
Whenever I meet people who call themselves "C++ experts" (e.g. in job interviews - great fun), I ask them for the difference between an lvalue, an rvalue, a glvalue, a prvalue, and an xvalue, just to show them how wrong they are. Usually they think I made those up, and I wish I had.
The bottom line is: That level of complexity is "the last thing D needs":
https://www.youtube.com/watch?v=KAWA1DuvCnQ

January 17

On Tuesday, 16 January 2024 at 21:27:27 UTC, bomat wrote:

>

Whenever I meet people who call themselves "C++ experts" (e.g. in job interviews - great fun), I ask them for the difference between an lvalue, an rvalue, a glvalue, a prvalue, and an xvalue, just to show them how wrong they are. Usually they think I made those up, and I wish I had.
The bottom line is: That level of complexity is "the last thing D needs":
https://www.youtube.com/watch?v=KAWA1DuvCnQ

Left value, right value is very simple. Do you think D language does not have left value, right value?

January 17

On Wednesday, 17 January 2024 at 00:36:52 UTC, zjh wrote:
Do you think `D

>

language` does not have left value, right value?

As a user, I don't care about the complexity of C++/D at all.
What I care about is that if it's not easy for me to use.

January 17

On Wednesday, 17 January 2024 at 00:40:27 UTC, zjh wrote:

>

What I care about is that if it's not easy for me to use.

And whether it meets my needs!

Like D's private ,is just part meet my need. so I am complaining it again and again!

1 2
Next ›   Last »