January 19, 2007
Yauheni Akhotnikau wrote:
> it's more correctly to use protected or public keyword in Foo, I think:

Right.

> I think the same situation is in your sample, because Foo<T> is a template class and it is necessary to use 'typename Foo<T>::' as a prefix for A in Base. So, do you think your sample 'Dependent Base Class Lookup' is correct in this context? May be better to speak about access to typedefs/alias in D's templates without 'typename' keyword?

I agree, we need a typename example.
January 19, 2007
Walter Bright wrote:

>> This table also makes some things clear that would be nice to have in D. The ones that jump out at me are templated constructors and overloading templated functions with other functions.
> 
> Templated constructors, yes,

Great!

> but the overloading thing is unnecessary and makes things more complicated than needed.

I would say it is bad news - calling special degenerated function to overload templated function is really unintuitive and probably every newcomer will fight with this.

See my problems with that: http://www.digitalmars.com/d/archives/digitalmars/D/learn/Is_it_a_compiler_bug_5478.html

and http://www.digitalmars.com/d/archives/digitalmars/D/bugs/Issue_798_New_Template_function_overloading_problems_9873.html

Additionally solutions with dummy template parameters are just ugly...

-- 
Regards
Marcin Kuszczak (Aarti_pl)
-------------------------------------
Ask me why I believe in Jesus - http://zapytaj.dlajezusa.pl (en/pl)
Doost (port of few Boost libraries) - http://www.dsource.org/projects/doost/
-------------------------------------

January 20, 2007
Walter Bright wrote:
> http://www.digitalmars.com/d/template-comparison.html
> 
> Comments?

Posted updated version based on comments so far.
January 20, 2007
Under "Parameters", C++98:

template<class T>
  class Foo
{
  T x;
};
Foo!<int> f;

Does C++ use the '!' point?  I thought that was D.  :)

-JJR
January 20, 2007
Walter Bright wrote:
> Jarrett Billingsley wrote:
>> In the "Pointer parameters" row, you might also want to add "delegates" to the D column, and make some mention of that ability in the "Pointer to member parameters" row (i.e. "No, D doesn't have pointers to parameters, it has delegates instead").
> 
> Good call.
> 
>> This table also makes some things clear that would be nice to have in D. The ones that jump out at me are templated constructors and overloading templated functions with other functions. 
> 
> Templated constructors, yes, but the overloading thing is unnecessary and makes things more complicated than needed.

Out of curiousity, what is it in particular that makes overloading of function templates difficult/complicated?  I have had occasions myself where it would've been highly welcome.  (Especially in the context of mixins, and especially as chains of more than three or four static-if blocks can get mighty unwieldy.  I have a project with a /recurring/ chain of about seven static-if's.  I'd be much happier with seven implementor's/mixin's that are easier to maintain, and to add/remove.)

-- Chris Nicholson-Sauls
January 20, 2007
Chris Nicholson-Sauls wrote:
> Out of curiousity, what is it in particular that makes overloading of function templates difficult/complicated?  I have had occasions myself where it would've been highly welcome.  (Especially in the context of mixins, and especially as chains of more than three or four static-if blocks can get mighty unwieldy.  I have a project with a /recurring/ chain of about seven static-if's.  I'd be much happier with seven implementor's/mixin's that are easier to maintain, and to add/remove.)

It's taking things with very different representations within the compiler and trying to make them the same.
January 20, 2007
John Reimer wrote:
> Under "Parameters", C++98:
> 
> template<class T>
>   class Foo
> {
>   T x;
> };
> Foo!<int> f;
> 
> Does C++ use the '!' point?  I thought that was D.  :)

LOL! That's what I get for hopping back and forth over the fence.
January 20, 2007
Walter Bright wrote:
> http://www.digitalmars.com/d/template-comparison.html
> 
> Comments?


This is great!  I even learned a bit more about C++'s templates.

-Joel
January 20, 2007
Walter Bright wrote:
> http://www.digitalmars.com/d/template-comparison.html
> 
> Comments?

What about automatic induction?  You probably want to link to a reason why D doesn't have it (since it will probably be questioned again and again).  You could also mention how aliasing can go some way to solving this difference.

-Joel
January 20, 2007
Walter Bright wrote:
> Walter Bright wrote:
>> http://www.digitalmars.com/d/template-comparison.html
>>
>> Comments?
> 
> Posted updated version based on comments so far.

What does it mean, the "Pointer Parameters - Yes, a pointer to object or function" or "it has delegates, which can be used as parameters"?
Isn't that saying that pointers and delegates can be used as (value) template parameters in D? But that is not the case.

In "Member templates parseable without hints", Foo.bar in the D code is a non-definition function declaration, right? Perhaps (just a minor nitpick) we could use an actual definition:
    Foo bar!(int I){ ... };
 since non-definition declaration are not normal D idioms, unlike in C++.

BTW, this comparison is very good, unlike the previous one about general language features. It shows how easy it is to use each feature (if available at all), which is what the programmer wants to know, which is what a comparison should show, which in turn most of the time cannot be fully expressed simply with just "Yes|No" remarks. That was a major point of "failure" of the previous comparison table, IMO, it was too fixed in a "has or has not explicit feature X" instead of "how easy it is to do Z".

-- 
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D