473,657 Members | 2,395 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 1844
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.c o.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.c o.uk wrote:
..sorry Maybe I misunderstood ... A library that 'uses' alot of
templates or a library that 'provides' alot of templates ?

Nind...@yahoo.c o.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(Cu stomList<char>& list);
};
The user of my library creates a set of instances of my template class:

CustomList<inti ntList;
CustomList<Pers onpersonList;
CustomList<char charList;
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<char charList;
CustomString myString(charLi st);
Is probable that my implementation of CustomList<Twil l 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(Cu stomList<char>& list);
};
The user of my library creates a set of instances of my template class:

CustomList<inti ntList;
CustomList<Pers onpersonList;
CustomList<char charList;
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<char charList;
CustomString myString(charLi st);
Is probable that my implementation of CustomList<Twil l 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.c o.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
18855
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 snippets of content-building code. I was thinking, how about adding a reference to an ASP or PHP include file directly in the style sheet. The new INCLUDE attribute I'm suggesting would be similar to the BEHAVIOR attribute except that it...
2
1876
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
1916
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 anyone knows ..please let me know. Thanks, Dev
2
6195
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 evaluating if we can easily resolve this issue. For example, I have a class MyClass consisting of 100 fields.
1
1658
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 able to debug code behind. However, when I try to debug the .js file the debugger doesn't hit the breakpoints! Any ideas? Mike --
3
3958
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 on VC6. We upgraded our compiler to ..NET 2005 for our new version. The new dll fails to load, we get a runtime error: R6034. We managed to work it around by creating a manifest file for the loading executable, but this is not an acceptable work...
0
1425
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 knows ..please let me know. Regards Bhargav
2
1834
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 A {
35
3770
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 gets about 3 or so. It also gets very awkward in nested loops, where you want to check for normal loop processing in the loop condition, not errors. Yes, you could put some generic exit flag in the loop condition, but when you're simply done if...
0
8394
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8825
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7327
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6164
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4152
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.