www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - DMD versions

reply Russel Winder <russel russel.org.uk> writes:
What is the official way of programmatically determining the version
number of the currently executing dmd?

Thanks.

--=20
Russel.
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder ekiga.n=
et
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel russel.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
Feb 18 2011
parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Fri, 18 Feb 2011 07:36:18 -0500, Russel Winder <russel russel.org.uk>  
wrote:

 What is the official way of programmatically determining the version
 number of the currently executing dmd?

 Thanks.
AFAIK, there isn't a way. You can only determine D2 vs D1. It would be a good feature to add to druntime though. Since druntime is inextricably linked with dmd, you could define an enum with the minor version. I remember Tango does this. -Steve
Feb 18 2011
parent reply Matthias Pleh <sufu alter.com> writes:
Am 18.02.2011 13:51, schrieb Steven Schveighoffer:
 On Fri, 18 Feb 2011 07:36:18 -0500, Russel Winder <russel russel.org.uk>
 wrote:

 What is the official way of programmatically determining the version
 number of the currently executing dmd?

 Thanks.
AFAIK, there isn't a way. You can only determine D2 vs D1. It would be a good feature to add to druntime though. Since druntime is inextricably linked with dmd, you could define an enum with the minor version. I remember Tango does this. -Steve
There is the special Token __VERSION__ which gives an integer. http://www.digitalmars.com/d/2.0/lex.html greets Matthias
Feb 18 2011
parent reply "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Fri, 18 Feb 2011 07:56:46 -0500, Matthias Pleh <sufu alter.com> wrote:

 There is the special Token __VERSION__ which gives an integer.

 http://www.digitalmars.com/d/2.0/lex.html
That works ;) I looked on the "conditional compilation" page. -Steve
Feb 18 2011
parent reply "Lars T. Kyllingstad" <public kyllingen.NOSPAMnet> writes:
On Fri, 18 Feb 2011 08:08:46 -0500, Steven Schveighoffer wrote:

 On Fri, 18 Feb 2011 07:56:46 -0500, Matthias Pleh <sufu alter.com>
 wrote:
 
 
 There is the special Token __VERSION__ which gives an integer.

 http://www.digitalmars.com/d/2.0/lex.html
That works ;) I looked on the "conditional compilation" page. -Steve
Also, there's std.compiler, which "decodes" the information in __VERSION__. http://www.digitalmars.com/d/2.0/phobos/std_compiler.html -Lars
Feb 18 2011
next sibling parent reply Russel Winder <russel russel.org.uk> writes:
On Fri, 2011-02-18 at 13:20 +0000, Lars T. Kyllingstad wrote:
 On Fri, 18 Feb 2011 08:08:46 -0500, Steven Schveighoffer wrote:
=20
 On Fri, 18 Feb 2011 07:56:46 -0500, Matthias Pleh <sufu alter.com>
 wrote:
=20
=20
 There is the special Token __VERSION__ which gives an integer.

 http://www.digitalmars.com/d/2.0/lex.html
That works ;) I looked on the "conditional compilation" page. =20 -Steve
=20 Also, there's std.compiler, which "decodes" the information in=20 __VERSION__. =20 http://www.digitalmars.com/d/2.0/phobos/std_compiler.html
Sadly (perhaps), when I said programmatically, I actually meant from Python. So gcc has the -v option giving output that can be "parsed" to find the version number. javac has the -version option, as does groovyc. OCaml has a -version option. gdc has a -v option. I could go on. dmd seemingly has no option for delivering a version number. Which is sad. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel russel.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Feb 18 2011
parent =?UTF-8?B?IkrDqXLDtG1lIE0uIEJlcmdlciI=?= <jeberger free.fr> writes:
Russel Winder wrote:
 On Fri, 2011-02-18 at 13:20 +0000, Lars T. Kyllingstad wrote:
 On Fri, 18 Feb 2011 08:08:46 -0500, Steven Schveighoffer wrote:

 On Fri, 18 Feb 2011 07:56:46 -0500, Matthias Pleh <sufu alter.com>
 wrote:


 There is the special Token __VERSION__ which gives an integer.

 http://www.digitalmars.com/d/2.0/lex.html
That works ;) I looked on the "conditional compilation" page. -Steve
Also, there's std.compiler, which "decodes" the information in=20 __VERSION__. http://www.digitalmars.com/d/2.0/phobos/std_compiler.html
=20 Sadly (perhaps), when I said programmatically, I actually meant from Python. So gcc has the -v option giving output that can be "parsed" to=
 find the version number.  javac has the -version option, as does
 groovyc. OCaml has a -version option.  gdc has a -v option. I could go
 on.  dmd seemingly has no option for delivering a version number.  Whic=
h
 is sad.
=20
Note that the =E2=80=9Cright way=E2=80=9D (tm) to get the gcc (or gdc) v= ersion is to use the =E2=80=9C-dumpversion=E2=80=9D option, whose output contains o= nly the version. Jerome --=20 mailto:jeberger free.fr http://jeberger.free.fr Jabber: jeberger jabber.fr
Feb 20 2011
prev sibling next sibling parent Jens Mueller <jens.k.mueller gmx.de> writes:
Russel Winder wrote:
 On Fri, 2011-02-18 at 13:20 +0000, Lars T. Kyllingstad wrote:
 On Fri, 18 Feb 2011 08:08:46 -0500, Steven Schveighoffer wrote:
 
 On Fri, 18 Feb 2011 07:56:46 -0500, Matthias Pleh <sufu alter.com>
 wrote:
 
 
 There is the special Token __VERSION__ which gives an integer.

 http://www.digitalmars.com/d/2.0/lex.html
That works ;) I looked on the "conditional compilation" page. -Steve
Also, there's std.compiler, which "decodes" the information in __VERSION__. http://www.digitalmars.com/d/2.0/phobos/std_compiler.html
Sadly (perhaps), when I said programmatically, I actually meant from Python. So gcc has the -v option giving output that can be "parsed" to find the version number. javac has the -version option, as does groovyc. OCaml has a -version option. gdc has a -v option. I could go on. dmd seemingly has no option for delivering a version number. Which is sad.
If you start dmd without any arguments it will give you the information as well. $ dmd Digital Mars D Compiler v2.052 ... So you can parse the first line of this output. Jens
Feb 18 2011
prev sibling parent reply Russel Winder <russel russel.org.uk> writes:
On Fri, 2011-02-18 at 14:47 +0100, Jens Mueller wrote:
[ . . . ]
 If you start dmd without any arguments it will give you the information
 as well.
 $ dmd
 Digital Mars D Compiler v2.052
 ...
=20
 So you can parse the first line of this output.
OK, that is the same as "dmd --help", I can make it work. Thanks. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel russel.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Feb 18 2011
parent reply Walter Bright <newshound2 digitalmars.com> writes:
Russel Winder wrote:
 On Fri, 2011-02-18 at 14:47 +0100, Jens Mueller wrote:
 If you start dmd without any arguments it will give you the information
 as well.
 $ dmd
 Digital Mars D Compiler v2.052
 ...

 So you can parse the first line of this output.
OK, that is the same as "dmd --help", I can make it work. Thanks.
Just for fun, try: dmd -man !!
Feb 22 2011
next sibling parent Russel Winder <russel russel.org.uk> writes:
On Tue, 2011-02-22 at 22:29 -0800, Walter Bright wrote:
[ . . . ]
 Just for fun, try:
=20
     dmd -man
=20
 !!
That presupposes you are connected to the Internet. Much of the time I am not. I appreciate this is an almost heretical position to be in but mobile Internet hasn't actually arrived despite being sold. Interestingly, or not, Go allows for imports to refer to non-local Bazaar, Mercurial and Git repositories without local caching which means you can't compile code unless you are connected to the Internet. Don't let D go (!) this route. --=20 Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D Dr Russel Winder t: +44 20 7585 2200 voip: sip:russel.winder ekiga.n= et 41 Buckmaster Road m: +44 7770 465 077 xmpp: russel russel.org.uk London SW11 1EN, UK w: www.russel.org.uk skype: russel_winder
Feb 23 2011
prev sibling parent Christopher Bergqvist <chris digitalpoetry.se> writes:
I've had an idea lately on that note. I'd think it would be cool if
rdmd (not standard dmd) had support for this style of import magic:

//  grab url:http://someserver.com/somelib/v1.0/src/somelib/somemodule.d
size:4321 sha1:2fd4e1c67a2d28fced849ee1bb76e7391b93eb12
import somelib.somemodule;

The hash & size of the file are there to make it very hard for someone
to take over someserver.com and put malicious code there which people
would download & run.

rdmd could also have options for turning this feature off/on or into
interactive mode where the user has to accept each download. Lets role
some local cashing in there while we're at it also. :) Refraining from
having a hash & size in there could be useful for unstable code but
those imports should not be used without conscious input from the
user. One could be allowed to view the code before typing "yes" and
having the code put into the cache.

On Wed, Feb 23, 2011 at 9:16 AM, Russel Winder <russel russel.org.uk> wrote=
:
 On Tue, 2011-02-22 at 22:29 -0800, Walter Bright wrote:
 [ . . . ]
 Just for fun, try:

 =A0 =A0 dmd -man

 !!
That presupposes you are connected to the Internet. =A0Much of the time I am not. =A0I appreciate this is an almost heretical position to be in but mobile Internet hasn't actually arrived despite being sold. Interestingly, or not, Go allows for imports to refer to non-local Bazaar, Mercurial and Git repositories without local caching which means you can't compile code unless you are connected to the Internet. =A0Don't let D go (!) this route. -- Russel. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D
 Dr Russel Winder =A0 =A0 =A0t: +44 20 7585 2200 =A0 voip: sip:russel.wind=
er ekiga.net
 41 Buckmaster Road =A0 =A0m: +44 7770 465 077 =A0 xmpp: russel russel.org=
.uk
 London SW11 1EN, UK =A0 w: www.russel.org.uk =A0skype: russel_winder
Feb 23 2011