Version bug?

2010-08-20 Thread Adam Ruppe
I just hit something that might be a compiler bug, or might be a documentation bug. (Of course, it can't be me! :P ) I have two modules: config.d === version (clientA) {} version ( clientB ) { version = withFeatureX; } version (clientC) { version = withFeatureX; } === application.d ===

Re: Version bug?

2010-08-20 Thread Adam Ruppe
If this behavior is by design, I suggest changing this sentence: http://www.digitalmars.com/d/2.0/version.html "Version identifiers defined in one module have no influence over other imported modules." To "Version identifiers defined in one module have no influence over other modules." Strikin

Re: Version bug?

2010-08-20 Thread Adam Ruppe
Sorry for three messages in a row, but I just realized what I'm asking for would break incremental compiles, since the version thing wouldn't be propagated there. So I guess it is by design. I think the documentation should be a bit more explicit about it. That kinda sucks though. I can't have tha

Re: Version bug?

2010-08-20 Thread Jonathan M Davis
On Friday, August 20, 2010 16:49:38 Adam Ruppe wrote: > I just hit something that might be a compiler bug, or might be a > documentation bug. (Of course, it can't be me! :P ) > > I have two modules: > > config.d > === > version (clientA) {} > > version ( clientB ) { > version = withFeatureX;

Re: Version bug?

2010-08-20 Thread Jonathan M Davis
On Friday, August 20, 2010 17:03:11 Adam Ruppe wrote: > Sorry for three messages in a row, but I just realized what I'm asking > for would break incremental compiles, since the version thing wouldn't > be propagated there. So I guess it is by design. I think the > documentation should be a bit more

Re: Version bug?

2010-08-20 Thread Adam Ruppe
Last message in a row, I promise. I just determined a work around for this - use a global variable. (the config.d file defines several global variables already, but it is stuff like companyName, domainName, etc.). A global enum actually: version(clientA) enum bool withFeatureX = true; =

Re: Version bug?

2010-08-20 Thread Andrej Mitrovic
mixin(import("file.d")); You need to pass -IPATH to DMD to use with imports like that, as in: dmd -IC:\blabla\ Thats a capital "i" there. > IIRC, you can do something with mixin and import to load in an external file > as > code, but since I've never used it and don't expect to any time soon (

Re: Version bug?

2010-08-20 Thread Andrej Mitrovic
There are no global variables in D, afaik. But I haven't studied this closely yet. On Sat, Aug 21, 2010 at 2:21 AM, Adam Ruppe wrote: > Last message in a row, I promise. > > I just determined a work around for this - use a global variable.

Re: Version bug?

2010-08-20 Thread Adam Ruppe
On 8/20/10, Andrej Mitrovic wrote: > There are no global variables in D, afaik. But I haven't studied this > closely yet. The opposite: there are multiple kinds. You have enums in the global scope, which are available to everyone, but don't take any storage (that's what I used here), you have re

Re: Version bug?

2010-08-20 Thread Andrej Mitrovic
I dunno, TDPL says: "D does not have a global scope or a global namespace. In particular, there is no way to define a truly global object, function, or class name. This is because the only way to define such an entity is to put it in a module, and any module has a name. In turn, the name of the mo

Re: Version bug?

2010-08-20 Thread Jonathan M Davis
On Friday, August 20, 2010 18:05:16 Andrej Mitrovic wrote: > There are no global variables in D, afaik. But I haven't studied this > closely yet. > > On Sat, Aug 21, 2010 at 2:21 AM, Adam Ruppe wrote: > > Last message in a row, I promise. > > > > I just determined a work around for this - use a

Re: Version bug?

2010-08-20 Thread Adam Ruppe
On 8/20/10, Andrej Mitrovic wrote: > I dunno, TDPL says: > *snip* That's true, though I think it is getting into nitpicking the definition of global variable still, the module system resolves conflicts in a way that C globals can't hope to do, which is fantastic. All the benefits with none of

Re: Version bug?

2010-08-20 Thread Andrej Mitrovic
As long as there is no ambiguity, right? Some of this stuff is on the next page but I haven't read it yet. I like how D handles modules, it seems much better than C and #includes. I only wish DMD could automatically do a build by passing dmd main.d , and letting it worry about all the imports, et

Re: Version bug?

2010-08-20 Thread Jonathan M Davis
On Friday, August 20, 2010 18:41:45 Andrej Mitrovic wrote: > As long as there is no ambiguity, right? > > Some of this stuff is on the next page but I haven't read it yet. I > like how D handles modules, it seems much better than C and > #includes. I only wish DMD could automatically do a build b

Re: Version bug?

2010-08-21 Thread Stewart Gordon
Adam Ruppe wrote: I just hit something that might be a compiler bug, or might be a documentation bug. (Of course, it can't be me! :P ) As has been said, it's by design. However, it does destroy much of the usefulness of VersionSpecification. As such, there ought to be an explicit means of

Re: Version bug?

2010-08-21 Thread Andrej Mitrovic
Oops, that was supposed to be dmd -JC:\blabla\ -I is for the path used in import declarations, -J is for import expressions. On Sat, Aug 21, 2010 at 2:23 AM, Andrej Mitrovic wrote: > mixin(import("file.d")); > > You need to pass -IPATH to DMD to use with imports like that, as in: > dmd -IC:\blab

Re: Version bug?

2010-08-22 Thread Walter Bright
Adam Ruppe wrote: Should it? Note that it does work correctly if I put the version= line in the actual file, but that means I can't have the nice centralized config module anymore. The compiler is exhibiting correct behavior. The idea is, versions exist only in the module's scope. You cannot s

Re: Version bug?

2010-08-23 Thread Adam D. Ruppe
On Sun, Aug 22, 2010 at 10:23:33PM -0700, Walter Bright wrote: > The compiler is exhibiting correct behavior. I think there should be an extra note in there: version specifications only apply to the module in which they appear. > can be tested by the importer with static if. These declarations ca

version bug? or am I missing something?

2011-06-28 Thread clone!(all)
The following outputs "Unicode!". If I reverse the comment for [1] and [2] however, the output is "ASCII". file a: module A; version = Unicode; [1] version(Unicode) { alias ChoiceA Choice; } else { alias ChoiceB Choice; } string ChoiceA() { re

Re: version bug? or am I missing something?

2011-06-28 Thread Jonathan M Davis
On 2011-06-28 19:22, clone!(all) wrote: > The following outputs "Unicode!". If I reverse the comment for [1] and > [2] however, the output is "ASCII". > > file a: > > module A; > > version = Unicode; [1] > > version(Unicode) > { > alias ChoiceA Choice; > }

Re: version bug? or am I missing something?

2011-06-28 Thread clone!(all)
On 6/29/2011 11:28 AM, Jonathan M Davis wrote: On 2011-06-28 19:22, clone!(all) wrote: The following outputs "Unicode!". If I reverse the comment for [1] and [2] however, the output is "ASCII". file a: module A; version = Unicode; [1] version(Unicode) {