[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.c++

templates

puzzlecracker

10/1/2008 1:56:00 AM

Team,

C++ has been around since 1986, why templates are still regarded is a
new feature by most compiler vendors and not fully supported (for
example export feature). Look at other popular languages -- say Java,
CSharp --and templates , also known as generics, are fully implemented
and supported in latest releases. Yes, in C++ they are implemented
differently, yet not better. Then why C++ is so lagging behind. Can't
we get ourself together? It took us a decade to come up with the new
standard, yet it's still in the making -- Java 6.0 and .NET 3.0
blossomed in record time.

What's with C++? To me it's the best (and primordial) programming
language that manage to get stuck in 1969, finding it hard to make a
transition from boy to man!

Thanks.
28 Answers

Victor Bazarov

10/1/2008 3:09:00 AM

0

puzzlecracker wrote:
> C++ has been around since 1986, why templates are still regarded is a
> new feature by most compiler vendors and not fully supported [..]
> why C++ is so lagging behind. Can't
> we get ourself together? [..]
> What's with C++? [..]

The compiler designers and implementors must have been patiently waiting
for *you* to join them in the effort...

On the second thought, stick to making noise here, it's less damage this
way. And we like you. Honest. We do. What are we going to do if
you'd leave us to work on improving C++'s handling of templates? <sob>

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask

James Kanze

10/1/2008 9:31:00 AM

0

On Oct 1, 3:55 am, puzzlecracker <ironsel2...@gmail.com> wrote:

> C++ has been around since 1986, why templates are still
> regarded is a new feature by most compiler vendors and not
> fully supported (for example export feature).

That is a real question. About the only answer I can give is
that I think that the vendors don't care about the standard (or
their users).

> Look at other popular languages -- say Java, CSharp --and
> templates , also known as generics, are fully implemented and
> supported in latest releases.

Two major differences. First, generics in Java (and I suppose
C#---I don't know the language) are several orders of magnitude
simpler than templates in C++. (And a lot less powerful.)
Second, neither language has a standard, and both have a
"primary provider", who more or less "standardizes" what he
wants, or in other words, what is easy for him to implement.

> Yes, in C++ they are implemented differently, yet not better.

They are specified differently, not just implemented
differently. As for better... C++ templates are significantly
more powerful than the templates in other languages, and that
does cause implementors problems.

> Then why C++ is so lagging behind. Can't we get ourself
> together? It took us a decade to come up with the new
> standard, yet it's still in the making -- Java 6.0 and .NET
> 3.0 blossomed in record time.

I'm tempted to say: it shows:-).

There's a major different: C++ has an ISO standard. Which
imposes a certain degree of stability. You can't change it
every six months.

--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

puzzlecracker

10/1/2008 12:58:00 PM

0


> That is a real question.  About the only answer I can give is
> that I think that the vendors don't care about the standard (or
> their users).

Unless, templates won't gain a wide acceptance, there is no reason not
to implement them. Usually more useful features packed in the
compiler, translates into $$$$


> Two major differences.  First, generics in Java (and I suppose
> C#---I don't know the language) are several orders of magnitude
> simpler than templates in C++.  (And a lot less powerful.)
> Second, neither language has a standard, and both have a
> "primary provider", who more or less "standardizes" what he
> wants, or in other words, what is easy for him to implement.

Wouldn't be better if standardization committee was affiliated, if not
fully responsible, for the implementation, much like with C# and Java?


> > Yes, in C++ they are implemented differently, yet not  better.
>
> They are specified differently, not just implemented
> differently.  As for better...  C++ templates are significantly
> more powerful than the templates in other languages, and that
> does cause implementors problems.

I agree, they're more powerful in essence, yet most its power has yet
to come to compiler vendors. At my current employer (as well as
previous) we don't have any code using templates; thought this is not
a representative sample set.



Thanks

Jeff Schwab

10/1/2008 12:59:00 PM

0

puzzlecracker wrote:
> Team,

Chief!

> C++ has been around since 1986, why templates are still regarded is a
> new feature by most compiler vendors and not fully supported (for
> example export feature).

The export feature never caught on because it requires much more
powerful linkers than people actually have, or else some heavy-handed
work-arounds in the build environment.

> Look at other popular languages -- say Java,
> CSharp --and templates , also known as generics, are fully implemented
> and supported in latest releases.Yes, in C++ they are implemented
> differently, yet not better.

Templates and generics are not the same thing. They're not even close,
except in syntax. Their nearest C++ relatives may be concept checks.
Whether templates are "better" is sort of an apples and oranges
comparison, but I'd certainly rather have C++ templates than Java generics.

> Then why C++ is so lagging behind. Can't
> we get ourself together? It took us a decade to come up with the new
> standard, yet it's still in the making -- Java 6.0 and .NET 3.0
> blossomed in record time.

"Us?" I wasn't aware you were on the ISO/IEC JTC1/SC22/WG21 committe.
Thank you for all your time and effort.

> What's with C++? To me it's the best (and primordial) programming
> language that manage to get stuck in 1969, finding it hard to make a
> transition from boy to man!

It's the best for some (OK, most) programming tasks, but certainly not
for all. It's kind of hard to write a practical client-side HTML form
validator in C++. By the way, I don't think "primordial" means what you
think it means.

Juha Nieminen

10/1/2008 2:31:00 PM

0

puzzlecracker wrote:
> Team,
>
> C++ has been around since 1986, why templates are still regarded is a
> new feature by most compiler vendors and not fully supported (for
> example export feature). Look at other popular languages -- say Java,
> CSharp --and templates , also known as generics, are fully implemented
> and supported in latest releases. Yes, in C++ they are implemented
> differently, yet not better. Then why C++ is so lagging behind. Can't
> we get ourself together? It took us a decade to come up with the new
> standard, yet it's still in the making -- Java 6.0 and .NET 3.0
> blossomed in record time.

Java and C# *don't* implement export templates, as defined by the C++
standard. Nothing even close.

Most modern C++ compilers implement almost everything in the C++
standard except export templates. That's not because all the compiler
developers are lazy. It's because it's a complicated problem (and not
something deemed very urgent, as people can live without).

puzzlecracker

10/1/2008 4:42:00 PM

0

On Oct 1, 10:30 am, Juha Nieminen <nos...@thanks.invalid> wrote:
> puzzlecracker wrote:
> > Team,
>
> > C++ has been around since 1986, why templates are still regarded is a
> > new feature by most compiler vendors and not fully supported   (for
> > example export feature). Look at other popular languages -- say Java,
> > CSharp --and templates , also known as generics, are fully implemented
> > and supported in latest releases. Yes, in C++ they are implemented
> > differently, yet not  better. Then why C++ is so lagging behind. Can't
> > we get ourself together?   It took us a decade to come up with the new
> > standard, yet it's still in the making -- Java 6.0 and .NET 3.0
> > blossomed in record time.
>
>   Java and C# *don't* implement export templates, as defined by the C++
> standard. Nothing even close.
>
>   Most modern C++ compilers implement almost everything in the C++
> standard except export templates. That's not because all the compiler
> developers are lazy. It's because it's a complicated problem (and not
> something deemed very urgent, as people can live without).



New standard is coming: any thoughts as to its commercial acceptance?
I wonder how much of cli will be compilable as well as used in the
industry upon its release

Erik Wikström

10/1/2008 4:46:00 PM

0

On 2008-10-01 14:58, puzzlecracker wrote:
>> That is a real question. About the only answer I can give is
>> that I think that the vendors don't care about the standard (or
>> their users).
>
> Unless, templates won't gain a wide acceptance, there is no reason not
> to implement them. Usually more useful features packed in the
> compiler, translates into $$$$
>
>
>> Two major differences. First, generics in Java (and I suppose
>> C#---I don't know the language) are several orders of magnitude
>> simpler than templates in C++. (And a lot less powerful.)
>> Second, neither language has a standard, and both have a
>> "primary provider", who more or less "standardizes" what he
>> wants, or in other words, what is easy for him to implement.
>
> Wouldn't be better if standardization committee was affiliated, if not
> fully responsible, for the implementation, much like with C# and Java?

Sure it would, will you pay them? The people who partake in the
standardisation effort does not get paid (at least not by ISO) to do so.
They do it on their own time and for their own money unless they can
convince some company to do it for them.

>> > Yes, in C++ they are implemented differently, yet not better.
>>
>> They are specified differently, not just implemented
>> differently. As for better... C++ templates are significantly
>> more powerful than the templates in other languages, and that
>> does cause implementors problems.
>
> I agree, they're more powerful in essence, yet most its power has yet
> to come to compiler vendors. At my current employer (as well as
> previous) we don't have any code using templates; thought this is not
> a representative sample set.

And what exactly is it that your compiler does not support (except for
export)? And what compiler are you using? Those compilers I've been
using supports templates quite well, while you might not be able to do
all the fancy MTP the standard allows you can do everything (except
export) that I've ever tried.

--
Erik Wikström

James Kanze

10/1/2008 7:53:00 PM

0

On Oct 1, 2:58 pm, puzzlecracker <ironsel2...@gmail.com> wrote:
> > That is a real question. About the only answer I can give
> > is that I think that the vendors don't care about the
> > standard (or their users).

> Unless, templates won't gain a wide acceptance, there is no
> reason not to implement them. Usually more useful features
> packed in the compiler, translates into $$$$

> > Two major differences. First, generics in Java (and I
> > suppose C#---I don't know the language) are several orders
> > of magnitude simpler than templates in C++. (And a lot less
> > powerful.) Second, neither language has a standard, and both
> > have a "primary provider", who more or less "standardizes"
> > what he wants, or in other words, what is easy for him to
> > implement.

> Wouldn't be better if standardization committee was
> affiliated, if not fully responsible, for the implementation,
> much like with C# and Java?

Yes. It would be great. Get a fully conformant compiler for
free.

The problem is: who's going to pay for it? In the case of Java
or C#, one company pays, because they control the specification,
in their interest, not in yours. In the case of C++, it's an
official international standard, and anyone can participate.
There are some real users on the committee, and several
different, competing implementors, so it doesn't end up working
for just one large company.

> > > Yes, in C++ they are implemented differently, yet not
> > > better.

> > They are specified differently, not just implemented
> > differently. As for better... C++ templates are
> > significantly more powerful than the templates in other
> > languages, and that does cause implementors problems.

> I agree, they're more powerful in essence, yet most its power
> has yet to come to compiler vendors.

Are you kidding? All of the power (e.g. export) isn't always
there, but many of the techniques not available in Java are
implemented in just about every compiler. (Well, at least the
ones available to me: g++, Sun CC and VC++.)

> At my current employer (as well as previous) we don't have any
> code using templates; though this is not a representative
> sample set.

I'll say. I think I qualify as one of the most conservative
users in production code, but I (and every company I've worked
for) started using templates close to ten years ago.
(Experimental implementations were available over twenty years
ago.)

--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

James Kanze

10/1/2008 7:56:00 PM

0

On Oct 1, 2:58 pm, Jeff Schwab <j...@schwabcenter.com> wrote:
> puzzlecracker wrote:

> The export feature never caught on because it requires much
> more powerful linkers than people actually have, or else some
> heavy-handed work-arounds in the build environment.

Comeau seems to do it without any problems. With the system
standard linker.

> > Look at other popular languages -- say Java, CSharp --and
> > templates , also known as generics, are fully implemented
> > and supported in latest releases.Yes, in C++ they are
> > implemented differently, yet not better.

> Templates and generics are not the same thing. They're not
> even close, except in syntax. Their nearest C++ relatives may
> be concept checks. Whether templates are "better" is sort of
> an apples and oranges comparison, but I'd certainly rather
> have C++ templates than Java generics.

At the user level, generics work more or less like the earliest
stuff we did with templates. (In other words, they're about
twenty years behind.)

--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34

James Kanze

10/1/2008 7:57:00 PM

0

On Oct 1, 6:42 pm, puzzlecracker <ironsel2...@gmail.com> wrote:
> On Oct 1, 10:30 am, Juha Nieminen <nos...@thanks.invalid> wrote:
> > puzzlecracker wrote:
> New standard is coming: any thoughts as to its commercial
> acceptance? I wonder how much of cli will be compilable as
> well as used in the industry upon its release

All of the major compiler vendors are actively working with the
committee, and for the most part, they're at least pretending
that they intend to implement whatever is standardized.

--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34