October 14, 2003
"Walter" <walter@digitalmars.com> wrote in message news:bmfk7k$lkg$1@digitaldaemon.com...
>
> "Matthew Wilson" <matthew@stlsoft.org> wrote in message news:bm9sds$25dr$1@digitaldaemon.com...
> > No! On operating systems that do not have a drive, it is absolutely
bogus
> > and evil to give them a "null" drive.
> >
> > (btw, Drive returns a char, not a string)
> >
> > Anyway, that's just the specific case. This will come up time and time again, probably almost as much as #define is used, so we need something
> that
> > works.
>
> I know what you mean. Where I'm coming from is that I have dealt a lot
with
> code that had lots of deeply embedded #ifdef's in it that are pushed down
to
> the lowest level possible.

An enormous amount is, and for ease of porting it would be good to facilitate what is there. To have to seriously rework logic at the same time as porting is going to reduce the likely success significantly. (Which I know I don't have to tell you, but am feeling in a didactic mood, so what the hell!)

> I eventually came to the conclusion that #ifdef's
> should be at a higher level (makes the code much easier to read).

Indeed they should. However, most are not.

> Perhaps
> it's at too high a level with version, but I want to give it a try and see
> how it goes.

I've tried. We've seen. Case proven, m'lod



October 14, 2003
"Nicolas Repiquet" <deadcow-remove-this@free.fr> wrote in message news:bm66gs$68l$1@digitaldaemon.com...
> Using different brace brings us back to the awful c-like preprocessor. Versioning is part of D's syntax, and that's great. But I agree that some versioning features are missing. I'm thinking about a version(...) expression returning a constant boolean. So you can solve your problem
like
> that :
>
>   recls_assert(0 == strcmp(path + ( version(Windows) ? 0 : 2 ),
pathCheck));
>   if(0 != strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck))
>   {
>     fprintf(stderr, "Path is different from path ..." );
>     abort();
>   }
>
>
> Constant folding optimization will (probably ?) make it as efficient as
old
> #if syntax.

I'm probably alone in my opinion on this <g>, but I like to see conditional compilation at a higher level than the expression level.


October 14, 2003
Walter wrote:
> "Nicolas Repiquet" <deadcow-remove-this@free.fr> wrote in message
> news:bm66gs$68l$1@digitaldaemon.com...
>>  if(0 != strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck))
>>  {
>>    fprintf(stderr, "Path is different from path ..." );
>>    abort();
>>  }
>>
>>
>>Constant folding optimization will (probably ?) make it as efficient as
> 
> old
> 
>>#if syntax.
> 
> 
> I'm probably alone in my opinion on this <g>, but I like to see conditional
> compilation at a higher level than the expression level.

Here's an idea.  We could retain the version() syntax at the statement level and add a keyword called "define" maybe for the expression level.


Something that I think could really hold back the power of version() is the inability to do even simple booleans (limited to version specifiers) or specify multiple versions at the same time, such as

version(NORWEGIAN || SPANISH)
version(NORWEGIAN, SPANISH)
version(NORWEGIAN && !UNITED_STATES)
etc.

#define is messy, but it is *very* flexible. (Not that I know C or C++.)

Justin

October 14, 2003
I really hope #define's not brought back, the main argument ive seens is that of porting, which seems a sort of 'backward-compatility' issue.  I understand the porting is important, but in my opionon not enough to change the language.  I would like to see JC's || and && implemented though.

C


"J C Calvarese" <jcc7@cox.net> wrote in message news:bmfn3r$p81$1@digitaldaemon.com...
> Walter wrote:
> > "Nicolas Repiquet" <deadcow-remove-this@free.fr> wrote in message news:bm66gs$68l$1@digitaldaemon.com...
> >>  if(0 != strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck))
> >>  {
> >>    fprintf(stderr, "Path is different from path ..." );
> >>    abort();
> >>  }
> >>
> >>
> >>Constant folding optimization will (probably ?) make it as efficient as
> >
> > old
> >
> >>#if syntax.
> >
> >
> > I'm probably alone in my opinion on this <g>, but I like to see
conditional
> > compilation at a higher level than the expression level.
>
> Here's an idea.  We could retain the version() syntax at the statement level and add a keyword called "define" maybe for the expression level.
>
>
> Something that I think could really hold back the power of version() is
> the inability to do even simple booleans (limited to version specifiers)
> or specify multiple versions at the same time, such as
>
> version(NORWEGIAN || SPANISH)
> version(NORWEGIAN, SPANISH)
> version(NORWEGIAN && !UNITED_STATES)
> etc.
>
> #define is messy, but it is *very* flexible. (Not that I know C or C++.)
>
> Justin
>


October 14, 2003
In article <bmfk7k$lkg$1@digitaldaemon.com>, Walter says... but I want to give it a try and see
>how it goes.
>
>

Ah, so D is just an experimental language, I see.


October 14, 2003
"Charles Sanders" <sanders-consulting@comcast.net> wrote in message news:bmfne8$pj4$1@digitaldaemon.com...
> I really hope #define's not brought back, the main argument ive seens is that of porting, which seems a sort of 'backward-compatility' issue.

<sarcastic:friendly>
So you want D to only ever run on one version of one flavour of one
platform? Shall we say Windows 2000 (NT family) on 686?
</sarcastic:friendly>

This issue is not just about porting from another language to D. That's just the latest thing that's given me cause to complain, i.e. when porting C++ code into the recls D mapping.

But this has caused much hassle in other D code, in the registry library, and I complained about it then.

To take my sarcastic comment seriously, it is quite true that if we do not provide sophisticated versioning within the language (and the current method is anything but), then we're going to have to stick to one platform, or we'll be jumping through hoops just as large (albeit less secretive) as are required in C and C++ with the preprocessor.

And let me make a "stance" observation: I like the C pre-processor, and I believe it, or something like it, should be available in all languages. However, that's not to say I like macros; I don't. Macros stink, and every time I have to use/write one I am much less happy than I am with using goto. (If you look at the STLSoft libs, you'll see plenty of #if discrimination, in order to support so many compilers and platforms, but you'll see very few macros, and I've cried a little tear for each. <g>)





October 14, 2003
I have my doubts too, but there have been times in C++ where I wished I could do it.

Sean

"Walter" <walter@digitalmars.com> wrote in message news:bmfkqg$mbk$1@digitaldaemon.com...
>
> "Nicolas Repiquet" <deadcow-remove-this@free.fr> wrote in message news:bm66gs$68l$1@digitaldaemon.com...
> > Using different brace brings us back to the awful c-like preprocessor. Versioning is part of D's syntax, and that's great. But I agree that
some
> > versioning features are missing. I'm thinking about a version(...) expression returning a constant boolean. So you can solve your problem
> like
> > that :
> >
> >   recls_assert(0 == strcmp(path + ( version(Windows) ? 0 : 2 ),
> pathCheck));
> >   if(0 != strcmp(path + ( version(Windows) ? 0 : 2 ), pathCheck))
> >   {
> >     fprintf(stderr, "Path is different from path ..." );
> >     abort();
> >   }
> >
> >
> > Constant folding optimization will (probably ?) make it as efficient as
> old
> > #if syntax.
>
> I'm probably alone in my opinion on this <g>, but I like to see
conditional
> compilation at a higher level than the expression level.
>
>


October 14, 2003
I think we just wish it was an experimental language.  ;)

Sean

"The Lone Haranguer" <The_member@pathlink.com> wrote in message news:bmfnf0$pkg$1@digitaldaemon.com...
> In article <bmfk7k$lkg$1@digitaldaemon.com>, Walter says... but I want to give it a try and see
> >how it goes.
> >
> >
>
> Ah, so D is just an experimental language, I see.


October 14, 2003
In article <bmfpcs$s87$1@digitaldaemon.com>, Matthew Wilson says...
>
>
>"Charles Sanders" <sanders-consulting@comcast.net> wrote in message news:bmfne8$pj4$1@digitaldaemon.com...
>> I really hope #define's not brought back, the main argument ive seens is that of porting, which seems a sort of 'backward-compatility' issue.
>
><sarcastic:friendly>
>So you want D to only ever run on one version of one flavour of one
>platform? Shall we say Windows 2000 (NT family) on 686?
></sarcastic:friendly>
>
>This issue is not just about porting from another language to D. That's just the latest thing that's given me cause to complain, i.e. when porting C++ code into the recls D mapping.
>
>But this has caused much hassle in other D code, in the registry library, and I complained about it then.
>
>To take my sarcastic comment seriously, it is quite true that if we do not provide sophisticated versioning within the language (and the current method is anything but), then we're going to have to stick to one platform, or we'll be jumping through hoops just as large (albeit less secretive) as are required in C and C++ with the preprocessor.
>
>And let me make a "stance" observation: I like the C pre-processor, and I believe it, or something like it, should be available in all languages. However, that's not to say I like macros; I don't. Macros stink, and every time I have to use/write one I am much less happy than I am with using goto. (If you look at the STLSoft libs, you'll see plenty of #if discrimination, in order to support so many compilers and platforms, but you'll see very few macros, and I've cried a little tear for each. <g>)
>
>
>
>
>

As has been said here before -- you can pass whatever file you want through the "C preprocessor". It is probably time to stop calling it that anyway and rename it, something like "the ANSI standard text replacement facility" (oh wait, then there can't be pragmas, oh well). As the D docs say; "the preprocessor is a different language from C".


1 2 3
Next ›   Last »