What's the secret to static class members

Lodovico Giaretta via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jun 29 10:29:08 PDT 2016


On Wednesday, 29 June 2016 at 17:00:49 UTC, Guido wrote:
> I have all this business generally working in C++. I just 
> wanted to try D for a production level quick project. So, the 
> language is not ready. I'm really sad about this. I had hoped 
> that I could get some useful work done. C++ is painfully slow 
> to write & debug, but what can you do.
>
> As I said, why exchange one set of bad design decisions for 
> another?
>
> On another topic, tuples seem to have a major problem as well.
>
> Tuple!(float, float, float) test;
> Tuple!(float, float, float) [] array_data;
>
> test[0] = 1.0;  // works
> array_data[i][0] = 1.0; // doesn't work. Compile-time error, 
> probably because the language itself doesn't have a dedicated 
> extension for tuple elements that is distinguished from array 
> dereferencing. This is the logical extension of how to access 
> tuples. I normally use structs in C++, but since pointer 
> arithmetic is really frowned upon in D, I decided to use 
> Tuples. A mistake, I supposed.
>
> So, I've spent a huge amount of time getting ready to write in 
> D. That's all wasted. I'll check back in another 10 years to 
> see if your hobby language is still around. In the mean time, 
> try to think about improving the compiler error messages. I can 
> write code any way the language demands, but it has to make 
> sense and I can't be doing a research project on the language 
> every 10 minutes to figure out the right incantation. I already 
> have that with C++.
>
> Bye

Fun fact: the following does work as expected.

Tuple!(float, float, float) test;
Tuple!(float, float, float) [] array_data = new Tuple!(float, 
float, float) [3];

test[0] = 1.0;
array_data[2][0] = 1.0;

So... if something does not work, please, have at least the 
maturity to post the actual code that does not work. Posting code 
that works and then complaining with your tone doesn't make you 
look very professional.

But I guess I'm just loosing my time.

Bye.


More information about the Digitalmars-d-learn mailing list