On Sat, Jan 27, 2024 at 05:55:24PM +0000, Gavin Smith wrote:
> On Sat, Jan 27, 2024 at 04:26:10PM +0100, Patrice Dumas wrote:
> > I have added a new interface in the version in development to get the
> > PACKAGE_VERSION and other PACKAGE* variables as set by configure:
> > 
> > my $texinfo_version = Texinfo::Common::get_constant('PACKAGE_AND_VERSION');
> > 
> > However, since you need to know the version to know if you can call that
> > function, this is probably be useful for you only when you do not
> > support versions older than the first version with that function anymore.
> 
> We should think carefully about the best interface for this as it is
> breaking backwards compatibility again.  We should have a good interface
> that we won't need to change in the future.  So I would not encourage
> users of the interface to change their compatibility code until we have
> finalised it.

You're right.

> The get_constant function has been recently added but I think the name of
> this is too generic.  It's only seems to be used for version information.
> Since the use of this is very limited, why not have special functions
> like, for example, Texinfo::Common::get_version which don't take any
> parameter?

We could have that in addition, but the get_constant function provides
more than the version, it provides all the PACKAGE* variables.  And I
think that it could provide more information.  In addition to the
usefulnes to get the PACKAGE* unmodified values, I thought that it could
be used to have also access in Perl to the macros available in C, to be
able to do similar code in both.  More generally, to me it should be the
interface to any information independent of customization, and output
format.  And it is good to have a function (although the name could be
different), such that, if needed, it can be overriden.

> I notice there is still use of PACKAGE_VERSION_OPTION in the source code.
> Is your plan to replace this?

No, I think that it is a good thing to have PACKAGE*OPTION that have the
same default values as PACKAGE* variables but can be customized.  It can
be used in output, and users may want to change the values.

> I don't know how ffmpeg or other packages are supposed to adapt to the
> new interface.  Perhaps we could put special case code in get_conf to
> check for "PACKAGE_VERSION" and redirect to the new interface?

That seems complicated.  To adapt to the change in name of the variable,
they can try both PACKAGE_VERSION and PACKAGE_VERSION_OPTION with
get_conf, that seems ok to me?

-- 
Pat

Reply via email to