473,508 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Idioms to handle backward compatibility using templates

Hi everybody:

I want to develop a library that uses heavily templates.

Is there an idiom or some tips about things that I should care of in
order to provide backward compatibility with my library?

(i. e., if I release new versions of my library, what things must I
consider to allow the applications that use it, run with no
recompilation? There is some idiom that helps to handle that (like the
pimpl idiom)? )

Regards,
Ernesto

Nov 9 '06 #1
7 1837
Ernesto Bascón wrote:
I want to develop a library that uses heavily templates.

Is there an idiom or some tips about things that I should care of in
order to provide backward compatibility with my library?

(i. e., if I release new versions of my library, what things must I
consider to allow the applications that use it, run with no
recompilation? There is some idiom that helps to handle that (like the
pimpl idiom)? )
"A template library changes to which don't require recompilation" seems
like an oxymoron.

Since most of what you're going to supply to your customers is source
code (in headers), any change in those will require recompilation.
I am unable to imagine a template library that only has interfaces to
some pimpl stuff. How useful is a template library when its guts are
independent from the types the user can use to instantiate the templates?
Or, looking from the other side, how can you actually implement that?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Nov 9 '06 #2
Hi,
I have similar needs and one thing I do is to have a 'pimpl' idiom at
Library level. That is
If my core Library is CoreLib, then I have a library PimplLib which
sits on top of CoreLib and behaves like a pimpl. I then use PimplLib to
tightly control what I expose from CoreLib and keep this interface a
minimal. ALL my clients then strictly interact with CoreLib through
PimplLib only. It works great for me. On lots of occasions I have
drstically changed the internals of CoreLib with no or very minor
modifications to PimplLib.

N
Ernesto Bascón wrote:
Hi everybody:

I want to develop a library that uses heavily templates.

Is there an idiom or some tips about things that I should care of in
order to provide backward compatibility with my library?

(i. e., if I release new versions of my library, what things must I
consider to allow the applications that use it, run with no
recompilation? There is some idiom that helps to handle that (like the
pimpl idiom)? )

Regards,
Ernesto
Nov 9 '06 #3
...sorry Maybe I misunderstood ... A library that 'uses' alot of
templates or a library that 'provides' alot of templates ?

Nind...@yahoo.co.uk wrote:
Hi,
I have similar needs and one thing I do is to have a 'pimpl' idiom at
Library level. That is
If my core Library is CoreLib, then I have a library PimplLib which
sits on top of CoreLib and behaves like a pimpl. I then use PimplLib to
tightly control what I expose from CoreLib and keep this interface a
minimal. ALL my clients then strictly interact with CoreLib through
PimplLib only. It works great for me. On lots of occasions I have
drstically changed the internals of CoreLib with no or very minor
modifications to PimplLib.

N
Ernesto Bascón wrote:
Hi everybody:

I want to develop a library that uses heavily templates.

Is there an idiom or some tips about things that I should care of in
order to provide backward compatibility with my library?

(i. e., if I release new versions of my library, what things must I
consider to allow the applications that use it, run with no
recompilation? There is some idiom that helps to handle that (like the
pimpl idiom)? )

Regards,


Ernesto
Nov 10 '06 #4
A library that provides a lot of templates!
Nind...@yahoo.co.uk wrote:
..sorry Maybe I misunderstood ... A library that 'uses' alot of
templates or a library that 'provides' alot of templates ?

Nind...@yahoo.co.uk wrote:
Hi,
I have similar needs and one thing I do is to have a 'pimpl' idiom at
Library level. That is
If my core Library is CoreLib, then I have a library PimplLib which
sits on top of CoreLib and behaves like a pimpl. I then use PimplLib to
tightly control what I expose from CoreLib and keep this interface a
minimal. ALL my clients then strictly interact with CoreLib through
PimplLib only. It works great for me. On lots of occasions I have
drstically changed the internals of CoreLib with no or very minor
modifications to PimplLib.

N
Ernesto Bascón wrote:
Hi everybody:
>
I want to develop a library that uses heavily templates.
>
Is there an idiom or some tips about things that I should care of in
order to provide backward compatibility with my library?
>
(i. e., if I release new versions of my library, what things must I
consider to allow the applications that use it, run with no
recompilation? There is some idiom that helps to handle that (like the
pimpl idiom)? )

Regards,


Ernesto
Nov 10 '06 #5
"A template library changes to which don't require recompilation" seems
like an oxymoron.
Look this case:

Let's say I provide the following classes:

template <class Tclass CustomList<T>;

class CustomString
{
public:
CustomString(CustomList<char>& list);
};
The user of my library creates a set of instances of my template class:

CustomList<intintList;
CustomList<PersonpersonList;
CustomList<charcharList;
As he has the implementation of the code, there is no problem when I
modify my implementation (because his binaries will implement the list
completely) except if he wants to share an instance of the class
template with a class implemented in the shared library, like:

CustomList<charcharList;
CustomString myString(charList);
Is probable that my implementation of CustomList<Twill be modified
and then, my CustomString class (implemented in my libraries) will
handle a wrong charList instance.


Since most of what you're going to supply to your customers is source
code (in headers), any change in those will require recompilation.
I am unable to imagine a template library that only has interfaces to
some pimpl stuff. How useful is a template library when its guts are
independent from the types the user can use to instantiate the templates?
Or, looking from the other side, how can you actually implement that?

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Nov 10 '06 #6
Is there a similar issue in the STL ? I would take my lead from there.
Ernesto Bascón wrote:
"A template library changes to which don't require recompilation" seems
like an oxymoron.

Look this case:

Let's say I provide the following classes:

template <class Tclass CustomList<T>;

class CustomString
{
public:
CustomString(CustomList<char>& list);
};
The user of my library creates a set of instances of my template class:

CustomList<intintList;
CustomList<PersonpersonList;
CustomList<charcharList;
As he has the implementation of the code, there is no problem when I
modify my implementation (because his binaries will implement the list
completely) except if he wants to share an instance of the class
template with a class implemented in the shared library, like:

CustomList<charcharList;
CustomString myString(charList);
Is probable that my implementation of CustomList<Twill be modified
and then, my CustomString class (implemented in my libraries) will
handle a wrong charList instance.


Since most of what you're going to supply to your customers is source
code (in headers), any change in those will require recompilation.
I am unable to imagine a template library that only has interfaces to
some pimpl stuff. How useful is a template library when its guts are
independent from the types the user can use to instantiate the templates?
Or, looking from the other side, how can you actually implement that?

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

Ni*****@yahoo.co.uk wrote in message ...
Is there a similar issue in the STL ? I would take my lead from there.

Ernesto Bascón wrote:

I do not respond to top-posted replies, please don't ask

Nice top-post. Been takeing lessons long?

(http://www.parashift.com/c++-faq-lit....html#faq-5.4).

A: Because it messes up the order in which people normally read text.
Q: Why is it such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?

Nov 10 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
18850
by: Mario T. Lanza | last post by:
If you're a web designer, you have undoubtedly used cascading style sheets in order to improve your sites separation of form and content. You probably also use Server-side include files to include...
2
1870
by: Neal Becker | last post by:
How can I write code to take advantage of new decorator syntax, while allowing backward compatibility? I almost want a preprocessor. #if PYTHON_VERSION >= 2.4 @staticmethod ....
1
1908
by: Dev | last post by:
Dear Friends, I have created VC++.NET dll by VS.NET2003.Is it possible to use this dll(vs.net2003) into C# version (Vs.net2002)? Is there backward compatibility? If so ..How do to this?..If...
2
6182
by: Dominic | last post by:
Hi everybody, I'm planning to use serialization to persist an object (and possibly its child objects) in my application. However, I'm concerned about the backward compatibility issue. I'm...
1
1645
by: MLibby | last post by:
I'm a Netscape newbie and am using it for backward compatibility testing. How do I debug javascript in Netscape? I set Netscape as the default debugger (design mode | file | Browse With) and I am...
3
3947
by: Madhu | last post by:
We are having a dll backward compatibility issue since we migrated to .NET 2005. As part of our product, we build a dll which is used by other products. Everything was fine when we were build it...
0
1411
by: bhargav mandlem | last post by:
hi friends i have created VC++.NET dll by VS.NET2003.Is it possible to use this dll(vs.net2003) into C# version (Vs.net2002)? Is there backward compatibility? If so ..How do to this?..If anyone...
2
1824
by: Ernesto Bascón | last post by:
Hi: I've read some about the pimpl idiom and I know that it provides safe ABI backward compatibility on shared libraries. Let's consider the following definitions: template <class T> class...
35
3738
by: jeffc226 | last post by:
I'm interested in an idiom for handling errors in functions without using traditional nested ifs, because I think that can be very awkward and difficult to maintain, when the number of error checks...
0
7124
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7385
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7498
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5053
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3195
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.