August 22, 2016
On Monday, 22 August 2016 at 18:04:43 UTC, Engine Machine wrote:
> How do you seriously think this is cleaner/simpler?
1. No extra encrypted things, such as InstantiateOrEmptySeq
2. Much more understandable.

> You have two classes.
No. I have one template with two specializations. Class template and class is not the same thing.

> Their is no uniformity between them.
They have the same name. This is the best uniformity.

> You have uniformity between all the derived classes then have a special case for the base class. A certain easy to follow pattern is set up but needlessly break it for one case. Why?
Because it is the base class. It has no parent. Also this is the standard and well known pattern in template metaprogramming.


August 22, 2016
On Monday, 22 August 2016 at 18:48:12 UTC, ag0aep6g wrote:
> You can take this further with template constraints. Gives it a more uniform appearance at the price of some repetition:
>
> ----
> class T()
> {
>     int x;
> }
>
> class T(A...) : T!(A[0..$-1])
>     if (A.length > 0 && A[$-1] == "Animal")
> {
>     int y;
> }
>
> class T(A...) : T!(A[0..$-1])
>     if (A.length > 0 && A[$-1] == "Dog")
> {
>     int z;
> }
>
> class T(A...) : T!(A[0..$-1])
>     if (A.length > 0 && A[$-1] == "Pug")
> {
>     int s;
> }
Yes. And even simpler, if to change the order of template parameters:

class T() {
    int x;
}

class T(string type : "Animal", A...) : T!A {
    int y;
}

class T(string type : "Dog", A...) : T!A {
    int z;
}

class T(string type : "Pug", A...) : T!A {
    int s;
}
August 22, 2016
On 08/22/2016 08:54 PM, Engine Machine wrote:
> Yeah, but a name means nothing. Change it if you want ;)

Even with a better name it still requires a good amount of thinking by the reader to see what's going on.

[...]
> What it achieves is a uniform way to create a hierarchical relationship
> without excessive verbosity.
[...]
> Ultimately it is just syntax, it does nothing over what D already does.
> It doesn't create anything new. In some cases it simplifies. If it does,
> then great, if it doesn't then don't use it. While I would prefer a
> totally different syntax, I also like to keep things organized. Having
> multiple classes floating around for certain things is just not needed
> so there should be an option.

So this is just to avoid typing out `class Pug : Dog {...} class Dog : Animal {...} class Animal {...}`? If so, I don't think it's worth the hassle. At least in the version so far, it doesn't seem to really cut down on the typing.
August 22, 2016
On Monday, 22 August 2016 at 19:56:08 UTC, ag0aep6g wrote:
> So this is just to avoid typing out `class Pug : Dog {...} class Dog : Animal {...} class Animal {...}`?
This allows you to create different inheritance chains with the same components quickly and easily. I don't know any use case, but looks funny:

T!("Animal", "Dog", "Pug") pug1;
T!("Life", "Animal", "Four-legged", "Pug") pug2;
T!("Dog", "Small", "Pug", ) smallPug;

August 22, 2016
On Monday, 22 August 2016 at 19:09:34 UTC, Jack Applegame wrote:
> On Monday, 22 August 2016 at 18:04:43 UTC, Engine Machine wrote:
>> How do you seriously think this is cleaner/simpler?
> 1. No extra encrypted things, such as InstantiateOrEmptySeq
> 2. Much more understandable.
>
>> You have two classes.
> No. I have one template with two specializations. Class template and class is not the same thing.
>
>> Their is no uniformity between them.
> They have the same name. This is the best uniformity.
>
>> You have uniformity between all the derived classes then have a special case for the base class. A certain easy to follow pattern is set up but needlessly break it for one case. Why?
> Because it is the base class. It has no parent. Also this is the standard and well known pattern in template metaprogramming.

I'm sorry if it confuses you... it doesn't confuse me. I do not know why you have to try and prove something that is a preference. Do you often get in to arguments with people about how ford is better than chevy or blonds are better than brunettes?
August 22, 2016
On Monday, 22 August 2016 at 21:46:35 UTC, Engine Machine wrote:
> I'm sorry if it confuses you... it doesn't confuse me.

You needed quite some help to get this thing to work. And you made some mistakes and wrong statements in the process. That's perfectly fine, but please don't act as if Jack is the simpleton while you're the brainiac.

> I do not know why you have to try and prove something that is a preference.

Jack showed a version which he thinks is "cleaner". And since this is a discussion board about code, it makes perfect sense for him to do that. If you don't care about it, you don't have to engage in discussion, of course.

> Do you often get in to arguments with people about how ford is better than chevy or blonds are better than brunettes?

Please don't take this to a personal level. Jack was talking about the code, and you start questioning his character. Not cool.

If you're happy with what you got, and you don't want to discuss other versions, you can say so without setting the stage for a shouting match. Simply not replying is an option, too. It may be a bit less polite, but it's better than escalating things.
August 23, 2016
On Monday, 22 August 2016 at 22:52:28 UTC, ag0aep6g wrote:
> On Monday, 22 August 2016 at 21:46:35 UTC, Engine Machine wrote:
>> I'm sorry if it confuses you... it doesn't confuse me.
>
> You needed quite some help to get this thing to work. And you made some mistakes and wrong statements in the process. That's perfectly fine, but please don't act as if Jack is the simpleton while you're the brainiac.
>

Um, please don't be an arrogant prick. I never said anything about that. He says it confuses him, I said it doesn't confuse me. Getting it to work in D has nothing to do with understanding the structure. It's like saying that because you can't understand English that you must be an imbecile.


>> I do not know why you have to try and prove something that is a preference.
>
> Jack showed a version which he thinks is "cleaner". And since this is a discussion board about code, it makes perfect sense for him to do that. If you don't care about it, you don't have to engage in discussion, of course.
>

So? I am the one that asked the question how to do X. He brings up Y, then you try to justify Y. It is illogical and insane to do so.

>> Do you often get in to arguments with people about how ford is better than chevy or blonds are better than brunettes?
>
> Please don't take this to a personal level. Jack was talking about the code, and you start questioning his character. Not cool.

No, Jack is talking about Y and people that try to change topics, like you have done, is insane and do the same thing with what I have stated. Keep it up though.

> If you're happy with what you got, and you don't want to discuss other versions, you can say so without setting the stage for a shouting match. Simply not replying is an option, too. It may be a bit less polite, but it's better than escalating things.

True, but then you should also take your own advice. But if a person can't be direct, honest, and talk specifically what is asked about, then it is already the well is already poisoned. But which will you option will you choose?




August 23, 2016
On 08/23/2016 03:23 AM, Engine Machine wrote:
> On Monday, 22 August 2016 at 22:52:28 UTC, ag0aep6g wrote:
[...]
>> Simply not replying is an option, too. It may be a bit less
>> polite, but it's better than escalating things.
>
> True, but then you should also take your own advice.

Yeah, I'm going to do that from now on regarding posts of yours.
August 23, 2016
On Monday, 22 August 2016 at 21:46:35 UTC, Engine Machine wrote:
> I'm sorry if it confuses you... it doesn't confuse me.
Confuses? No.
> I do not know why you have to try and prove something that is a preference. Do you often get in to arguments with people about how ford is better than chevy or blonds are better than brunettes?
You're wrong again. I don't try to prove anything, just answer your questions.
But finally I understood your main goal:
You don't want to see more than one 'class' keyword. You want that recursive class template automatically stops inheritance without any additional moves, such as specializations, static ifs and so on.


1 2 3
Next ›   Last »