Topic: People don't use templates. Film at 11.


Author: Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.COM>
Date: Sat, 30 Jan 2010 09:58:59 CST
Raw View
>
>
> In the absense of export, people don't use templates.
>
We don't?  That is surprising.  Well, they say that one learns something
new each day ...

Unless "at the application level" means something less straightforward
than "in multiple modules across an entire application", I'm fairly sure
that I and others have used templates "at the application level" in the
absence of export.  So what was your non-straightforward meaning?  (-:

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: James Kanze <james.kanze@gmail.com>
Date: Sun, 31 Jan 2010 21:26:43 CST
Raw View
On 30 Jan, 15:58, Jonathan de Boyne Pollard <J.deBoynePollard-
newsgro...@NTLWorld.COM> wrote:
> > In the absense of export, people don't use templates.

> We don't?  That is surprising.  Well, they say that one learns
> something new each day ...

> Unless "at the application level" means something less
> straightforward than "in multiple modules across an entire
> application", I'm fairly sure that I and others have used
> templates "at the application level" in the absence of export.
> So what was your non-straightforward meaning?  (-:

At the application level means the code you're developing, as
opposed to more or less stable libraries.  And some people
probably do use templates at this level as well.  For very
small, trivial applications, it may still be OK.  But most of
the places I've seen which develop larger applications ban
templates (and inline functions) at this level because of the
coupling it introduces.

--
James Kanze

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use
mailto:std-c++@netlab.cs.rpi.edu<std-c%2B%2B@netlab.cs.rpi.edu>
]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: "Balog Pal" <pasa@lib.hu>
Date: Sun, 31 Jan 2010 21:26:09 CST
Raw View
"Jonathan de Boyne Pollard"

> In the absense of export, people don't use templates.
>>
>> We don't?  That is surprising.  Well, they say that one learns something
> new each day ...
>
> Unless "at the application level" means something less straightforward
> than "in multiple modules across an entire application", I'm fairly sure
> that I and others have used templates "at the application level" in the
> absence of export.  So what was your non-straightforward meaning?  (-:
>

We indeed hardly use templates at application level. Though IMO it has
little to do with export -- just too few opportunities.  Templates serve
good for libraries.

If a piece of code can be extracted as a "generic" with just type
substitution, that aligns too well with what we keep libraries for, don't
we?

James probably meant that the lack of export results template-using
libraries that are too "pure", and if the implementation would need
inclusion of some specific stuff, it will be avoided.  I don't think so --
 it is merely annoying, but what is the alternative?  Copy/paste?  Write a
source code generator?


--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use
mailto:std-c++@netlab.cs.rpi.edu<std-c%2B%2B@netlab.cs.rpi.edu>
]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]





Author: James Kanze <james.kanze@gmail.com>
Date: Tue, 2 Feb 2010 01:01:48 CST
Raw View
On Feb 1, 3:26 am, "Balog Pal" <p...@lib.hu> wrote:
> "Jonathan de Boyne Pollard"

> > In the absense of export, people don't use templates.

> >> We don't?  That is surprising.  Well, they say that one
> >> learns something new each day ...

> > Unless "at the application level" means something less
> > straightforward than "in multiple modules across an entire
> > application", I'm fairly sure that I and others have used
> > templates "at the application level" in the absence of
> > export.  So what was your non-straightforward meaning?  (-:
>
> We indeed hardly use templates at application level. Though
> IMO it has little to do with export -- just too few
> opportunities.  Templates serve good for libraries.

There is that, of course.

> If a piece of code can be extracted as a "generic" with just
> type substitution, that aligns too well with what we keep
> libraries for, don't we?

> James probably meant that the lack of export results
> template-using libraries that are too "pure", and if the
> implementation would need inclusion of some specific stuff, it
> will be avoided.  I don't think so -- it is merely annoying,
> but what is the alternative?  Copy/paste?  Write a source code
> generator?

In practice, it's always a trade off.  You weigh the advantages
and the disadvantages.  If the alternative is <generic.h>, then
templates, even without export, are an enormous win.  But it's
not rare to prefer a bit of duplicate code to the additional
coupling templates introduce.

--
James Kanze

--
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@netlab.cs.rpi.edu]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.comeaucomputing.com/csc/faq.html                      ]