June 08, 2005
Why are stdin/stdout/stderr deprecated?
Is it recommended to use din/dout/derr instead?
Any way to keep the source compatible with GDC?

June 08, 2005
On Wed, 08 Jun 2005 15:33:36 +0200, Anders F Björklund wrote:

> Derek Parnell wrote:
> 
>> Ummm... I've got a problem ...
>> 
>>  void main()
>>  {
>>     Object x;
>> 
>>     version (DigitalMars)
>>     {
>>         if (x !is null) {}
>>     }
>>     else
>>     {
>>         if (x !== null) {}
>>     }
>>  }
>> 
>> I expected that by using the DigitalMars compiler that I wouldn't get ...
>> 
>>    "test.d(11): '!==' is deprecated, use '!is' instead"
> 
> Since versions are not #if, I don't think there is any way
> to make the same source code compile on new DMD and old DMD...
> (or GDC, which is at DMD 0.125 thanks to David heroic efforts)
> 
> Which leaves the option towards the usual:
> 1) Require DMD 0.126 and above, in your docs
> 2) Use the deprecated features and the -d flag

Sorry, neither is acceptable. Today we are only talking about deprecated functionality, but it can (and has) been deeper syntax issues like the '$' introduction.

Unless Walter provides a way, I will be forced into using a preprocessor to generate compilable source code for all the platforms I am hoping to support. This means I also have to make available multiple editions of the source files available so people can download the one(s) they need. Just plain stupidity!

[snip]

> PS. What about the there-is-no-spoon option ? (alias spoon bool;)
>      void main()
>      {
>        Object x;
>        if (x) {}
>      }
>      Or are we still hoping for those expressions to be illegal ?

I don't care if it is illegal or not; to me this form is not sufficiently expressing my meaning. I regard it as an abbreviation where one is not appropriate. Of course, that is only a personal opinion ;-)

-- 
Derek Parnell
Melbourne, Australia
8/06/2005 11:53:16 PM
June 08, 2005
Derek Parnell wrote:

> Unless Walter provides a way, I will be forced into using a preprocessor to
> generate compilable source code for all the platforms I am hoping to
> support. This means I also have to make available multiple editions of the
> source files available so people can download the one(s) they need. Just
> plain stupidity!

Yes, that is a third option...

As far as I know, that was the option that the Java libraries
resorted to in order to make the same source code compilable
by different versions (generations) of the language compiler.

Like when switching from JDK 1.1.8 to 1.3.1, or 1.4.2 to 1.5.0

Then again, Java doesn't have *any* conditional compilation ?
But D has, even if it's not as "flexible" as a preprocessor is.
So there should be some way to address this problem that D has.

--anders
June 08, 2005
"zwang" <nehzgnaw@gmail.com> wrote in message news:d86t3v$1rf1$1@digitaldaemon.com...
> Why are stdin/stdout/stderr deprecated?
It seemed redundant to have two Stream interfaces to stdin/out and din/out mesh better with std.c.stdin/out. The downside is that din/out aren't std.stream.Files.

> Is it recommended to use din/dout/derr instead?
If one needs a Stream then use din/dout/derr.

> Any way to keep the source compatible with GDC?
Compile with -d to enable deprecated features, I guess.


June 08, 2005
In article <trch1jhcb7pj.1qubpmdg2vvtf.dlg@40tude.net>, Derek Parnell says...
>
>On Tue, 7 Jun 2005 22:17:50 -0700, Walter wrote:
>
>> Added inner classes.
>> 
>> http://www.digitalmars.com/d/changelog.html
>
>Ummm... I've got a problem ...
>
> void main()
> {
>    Object x;
> 
>    version (DigitalMars)
>    {
>        if (x !is null) {}
>    }
>    else
>    {
>        if (x !== null) {}
>    }
> }
>
>I expected that by using the DigitalMars compiler that I wouldn't get ...
>
>   "test.d(11): '!==' is deprecated, use '!is' instead"

Disappointing, but not unexpected for me.

It's not ideal, but doesn't this work for both the current DMD and the latest
GDC?
if (!(x is null))

I know it's a little cumbersome, but I think it'd be better than using a preprocessor.

Hopefully, GDC will sync up with the current DMD pretty soon again since there are so many significant changes in DMD 0.126.

jcc7
June 08, 2005
Walter wrote:
> Added inner classes.
> 
> http://www.digitalmars.com/d/changelog.html
> 
> 
> 

Ok. I've had some problems switching from iftype to static if (is(T:real)), but now I've come across something that really doesn't make any sense...

I've attached two files, and the question i ask is, why does test1.d fail to compile, while test2.d compiles, if the only difference between them is...

from test1.d...

          static if(is(T : real))
          {
             inta!(T)(dat);
          }
          else if(is(T : Object))
          {
             obj!(T)(dat);
          }
          else // assume it is a struct
          {
             str!(T)(dat);
          }

vs this from test2.d...

          static if(is(T : Object))
          {
             obj!(T)(dat);
          }
          else // assume it is a struct
          {
             str!(T)(dat);
          }

test1.d blurts out the compiler error, ...

test1.d(35): incompatible types for ((dat) === (null)): 'Point' and 'void*'
test1.d(36): cannot implicitly convert expression (new Point *) of type
Point * to Point
test1.d(14): template instance temp.Foo.obj!(Point ) error instantiating
test1.d(18): function expected before (), not template instance
str!(Point ) of type void
test1.d(70): template instance temp.Foo.bar!(Point ) error instantiating

Are you not allowed to use static if for multiple layers? I figured out I can fix it by using ...

          static if(is(T : real))
          {
             inta!(T)(dat);
          }
          static if(is(T : Object))
          {
             obj!(T)(dat);
          }
          else // assume it is a struct
          {
             str!(T)(dat);
          }

-clayasaurus


June 08, 2005
"Stewart Gordon" <smjg_1998@yahoo.com> wrote in message news:d86gob$1g0e$1@digitaldaemon.com...
> zwang wrote:
> > Walter wrote:
> >
> >> Added inner classes.
> >>
> >> http://www.digitalmars.com/d/changelog.html
> >
> > Wow, that looks like a major update. Thanks!
> > I'm not sure whether it's time to upgrade, though.
> > So many things are deprecated in version 0.126.
>
> And so many things changed their behaviour.  Like nested classes and unsuccessful AA lookups.

With the deprecation detection by the compiler, finding the problem areas is pretty simple, and they're easilly fixed.


June 08, 2005
"Derek Parnell" <derek@psych.ward> wrote in message news:zu8pxspfqpou$.j798zboqpqeo$.dlg@40tude.net...
> WTF do I have to code so I only have to support one source file for multiple compilers? I don't really want one version of the Build application source for the GDC compiler and another set of source files
for
> the DigitalMars compiler. At this stage, I'm going to have to revert to a macro preprocessor again! I'm sure that is not what Walter envisioned his D-isciples doing.

Compiling with -d will allow the use of deprecated features.


June 08, 2005
"Derek Parnell" <derek@psych.ward> wrote in message news:skmeququbanx$.a6mchwy1wg9c.dlg@40tude.net...
> Unless Walter provides a way, I will be forced into using a preprocessor
to
> generate compilable source code for all the platforms I am hoping to support. This means I also have to make available multiple editions of the source files available so people can download the one(s) they need. Just plain stupidity!

But that's the point of having the -d switch!

And since compiler updates are free, there's no reason to support older versions once GDC gets updated.


June 08, 2005
"xs0" <xs0@xs0.com> wrote in message news:d86npf$1m4i$1@digitaldaemon.com...
> You're the man!
>
> Really, I think it's amazing how fast you did full inner classes support
> (and even some other stuff)! Do you take apprentices? :)

Actually, I implemented it 3 times before I figured out the right way to install it. Nested classes are fairly similar to nested functions, so many of the internal compiler issues had already been solved.