[Issue 2370] Version statement enhancement: versioned identifiers

Sergey Gromov snake.scaly at gmail.com
Wed Oct 15 10:27:46 PDT 2008


I don't see a point in continuing to spam bugzilla, so I'll answer here.

> ------- Comment #12 from brunodomedeiros+bugz at gmail.com  2008-10-15 09:57 -------
> (In reply to comment #7)
> > (In reply to comment #6)
> > > If you add a specific feature in a given version, it's best (clearer) to add a:
> > >   version = NiftyMyLibCallAvailable;
> > > and then use:
> > >   version(NiftyMyLibCallAvailable)
> > >   {
> > >     NiftyMyLibCall();
> > >   }
> > > instead of version numbers.
> > Is there *any* library around that has a version/#define for every single
> > interface and every single change in that interface?  I don't think so, it's
> > just not feasible.
> 
> I've seen the equivalent, in Java. Namely in Eclipse, where the API is managed
> through the use of interfaces. Whenever new functionality is added, they don't
> changed the existing interface, but add a new one, with a name like
> IFooExtension4 Example:
> http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/jface/text/ITextViewerExtension7.html
> There are dozens of interfaces like that. (although few reach as many as a 7th
> version)

It's not the same as defining a separate version statement for every 
feature, especially when there's nowhere to define them.

I think this solution can be applied to D directly, with either run-time 
or compile-time checks for available interfaces.  But this approach 
doesn't seem to be widely adopted and I believe there are reasons behind 
it.  For instance, I don't want to check all and every interface in my 
code and support workarounds and fallbacks.  I want to use a specific 
interface subset available in a particular library version.  If later I 
want to use a particular cool feature from a newer version then it 
doesn't quite matter whether it is implemented via versions or 
interfaces, but if I want *all* the cool stuff I probably don't want to 
mess with all the interface details again.  I simply use the older code 
if all the cool features are not available.

It's a matter of usage patterns, and I don't think many developers want 
to support any combination of features provided by a library.

> (In reply to comment #9)
> > (In reply to comment #8)
> > > Several of the comments seem to be forgetting that "version = bob" in an
> > > imported file has no effect on "version(bob)" statements in the importing file.
> > You're right.  This is a very strange and undocumented behavior.  Well, this
> > adds more value to my proposal: writing 21 version statements in command line
> > is... well, tedious.
> 
> If you use a proper build tool, editor, or IDE (which you obviously should),
> you should only have to write these statements *once*, which hardly counts as
> tedious or even significant.

I use whatever I want.  And I tend not to use IDEs unless I'm forced to.  
Anyway, should I write these statements "once" for every Hello World?  Or 
for every library I attach to my hypothetical IDE?  The result should be 
a bunch of version statements for every library I use in my project.  How 
do they get there?


More information about the Digitalmars-d-bugs mailing list