www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Feature request: global versions

reply Vathix <vathix dprogramming.com> writes:
It would be nice to be able to add global versions via pragma, like:
    pragma(version, "my_global_version");
I understand the reasons behind the current version system, but sometimes  
it's very handy for a library to have a single version to turn on a bunch  
of others.

Perhaps if the version is only set after the pragma (not forward  
referenced) it will still be easy for tools to use.

Example:

version(WINNT_5_1)
{
    pragma(version, "supports_opacity");
    pragma(version, "supports_mouse_tracking");
    pragma(version, "supports_visual_styles");
    // ...
}

It could go on and on for different versions and features. Do we really  
want to put all those versions on the command line?

The version numbers like version=5 could work here, but it just doesn't  
cut it; I think those version numbers should be left to the end  
application, not libraries.
Mar 16 2005
next sibling parent reply xs0 <xs0 xs0.com> writes:
Hmm, I think you can do

version(WINNT_5_1)
{
    version=supports_opacity;
    version=supports_mouse_tracking;
    // etc
}


xs0

Vathix wrote:
 It would be nice to be able to add global versions via pragma, like:
    pragma(version, "my_global_version");
 I understand the reasons behind the current version system, but 
 sometimes  it's very handy for a library to have a single version to 
 turn on a bunch  of others.
 
 Perhaps if the version is only set after the pragma (not forward  
 referenced) it will still be easy for tools to use.
 
 Example:
 
 version(WINNT_5_1)
 {
    pragma(version, "supports_opacity");
    pragma(version, "supports_mouse_tracking");
    pragma(version, "supports_visual_styles");
    // ...
 }
 
 It could go on and on for different versions and features. Do we really  
 want to put all those versions on the command line?
 
 The version numbers like version=5 could work here, but it just doesn't  
 cut it; I think those version numbers should be left to the end  
 application, not libraries.
Mar 16 2005
parent Vathix <vathix dprogramming.com> writes:
On Wed, 16 Mar 2005 17:37:02 +0100, xs0 <xs0 xs0.com> wrote:

 Hmm, I think you can do

 version(WINNT_5_1)
 {
     version=supports_opacity;
     version=supports_mouse_tracking;
     // etc
 }
But they're not global, they will only be set in that module.
Mar 16 2005
prev sibling next sibling parent reply Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vathix schrieb am Wed, 16 Mar 2005 11:28:56 -0500:
 It would be nice to be able to add global versions via pragma, like:
     pragma(version, "my_global_version");
 I understand the reasons behind the current version system, but sometimes  
 it's very handy for a library to have a single version to turn on a bunch  
 of others.

 Perhaps if the version is only set after the pragma (not forward  
 referenced) it will still be easy for tools to use.

 Example:

 version(WINNT_5_1)
 {
     pragma(version, "supports_opacity");
     pragma(version, "supports_mouse_tracking");
     pragma(version, "supports_visual_styles");
     // ...
 }

 It could go on and on for different versions and features. Do we really  
 want to put all those versions on the command line?
Setting/changing trans-file parsing properties like version inside of your source code raises a big issue. Either the parsing depends on the order those files are parsed or all currently parsed files have to be reparsed (risking circular - read: endless - reparsing). Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCOGdk3w+/yD4P9tIRAjkhAKCxDoaJ8/Y2sSnHpMUBRkanJWfOfgCcCjLn CjzxSwMJ4DCq2yYe1Bn3tak= =8zDH -----END PGP SIGNATURE-----
Mar 16 2005
parent pragma <pragma_member pathlink.com> writes:
In article <4k5mg2-cvj.ln1 lnews.kuehne.cn>, Thomas Kuehne says...
Setting/changing trans-file parsing properties like version inside of
your source code raises a big issue.

Either the parsing depends on the order those files are parsed or
all currently parsed files have to be reparsed
(risking circular - read: endless - reparsing).
Ahh.. gotcha. Just ignore my previous response then. I didn't even think about the compilation-order dependency that this would generate. - EricAnderton at yahoo
Mar 16 2005
prev sibling parent pragma <pragma_member pathlink.com> writes:
In article <opsnqn2irtkcck4r 24-49-100-147.kntnny.adelphia.net>, Vathix says...
It would be nice to be able to add global versions via pragma, like:
    pragma(version, "my_global_version");
I understand the reasons behind the current version system, but sometimes  
it's very handy for a library to have a single version to turn on a bunch  
of others.

Perhaps if the version is only set after the pragma (not forward  
referenced) it will still be easy for tools to use.
No need to use a pragma. We already use public/private for import, so why not for version and debug too?
 public version = foo;
 public debug = bar;
..as the default use of version is already 'private' in a sense. Also, it makes the behavior *very* explicit (which I think is why they're 'private' now). - EricAnderton at yahoo
Mar 16 2005