www.digitalmars.com         C & C++   DMDScript  

D - D alpha compiler

reply "Walter" <walter digitalmars.com> writes:
This is mainly to help along discussion of language features and to see what
fundamental issues I've overlooked!

ftp://ftp.digitalmars.com/dmdalpha.zip

Enjoy.

-Walter
Dec 08 2001
next sibling parent reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
Walter wrote:

 This is mainly to help along discussion of language features and to see what
 fundamental issues I've overlooked!

 ftp://ftp.digitalmars.com/dmdalpha.zip

 Enjoy.

 -Walter
Would you like us to post bugs (other than not-implemented-features listed in the docs)? -- The Villagers are Online! http://villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]
Dec 08 2001
parent reply "Walter" <walter digitalmars.com> writes:
"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
news:3C12991D.67140D22 deming-os.org...
 Walter wrote:

 This is mainly to help along discussion of language features and to see
what
 fundamental issues I've overlooked!

 ftp://ftp.digitalmars.com/dmdalpha.zip

 Enjoy.

 -Walter
Would you like us to post bugs (other than not-implemented-features listed
in
 the docs)?
I'm absolutely interested in any and all bug reports. Post away, there's nothing secret here! As for the bugs listed in the doc, I'm interested in what priorities people have for them. I need to get it whipped into shape before my DDJ article on D gets published! -Walter
Dec 08 2001
next sibling parent reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
Bug 0001: Trailing (superfluous) semicolons cause syntax errors.

I know, I know, all the style purists hate me for this...but somewhere, early
when I learned C++, I got into the habit of adding superfluous semicolons after
my functions and other blocks:

void foo()
{
    ....
};



It's ugly (to most people's eyes), but legal (I think)

--
The Villagers are Online! http://villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]
Dec 08 2001
next sibling parent reply "Pavel Minayev" <evilone omen.ru> writes:
"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
news:3C12B1C5.47154D71 deming-os.org...
 Bug 0001: Trailing (superfluous) semicolons cause syntax errors.
 I know, I know, all the style purists hate me for this...but somewhere,
early
 when I learned C++, I got into the habit of adding superfluous semicolons
after
 my functions and other blocks:

 void foo()
 {
     ....
 };



 It's ugly (to most people's eyes), but legal (I think)
Not sure. I might be wrong, but AFAIK VC++ doesn't allow such things. Borland compilers do. Is it in ANSI C++ or not, I wonder? Not sure I'd like to see it be legal in D, anyhow.
Dec 09 2001
parent Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
I use it all over my MSVC code.

Frankly, any superfluous semicolons should be treated by the compiler as null
statements.  I know that that is true in code, I can't swear that it's accurate
in function body declarations...but I think that it's true there, too.

--
The Villagers are Online! http://villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]
Dec 09 2001
prev sibling parent "Walter" <walter digitalmars.com> writes:
Ok, I'll fix it to allow empty declarations, mainly to be symmetric with
allowing empty statements. -Walter

"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
news:3C12B1C5.47154D71 deming-os.org...
 Bug 0001: Trailing (superfluous) semicolons cause syntax errors.

 I know, I know, all the style purists hate me for this...but somewhere,
early
 when I learned C++, I got into the habit of adding superfluous semicolons
after
 my functions and other blocks:

 void foo()
 {
     ....
 };
 It's ugly (to most people's eyes), but legal (I think)
Dec 09 2001
prev sibling next sibling parent reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
Bug 0002: Link problems

I compiled the following source file, wanting to test out how the GC works:

        import stdio;

        class Foo
        {
          static this() { printf("%p ",this); }
          ~this () { printf("~%p ",this); }
        }

        int main()
        {
          {
            Foo ptr = new Foo;
            printf("x");
          }
          printf("x");
          long i;
          for(i=0; i<1000*1000*1000; i++);
          printf("x");
          return 0;
        }

My makefile was as follows:

        russ.exe: russ.obj
                link ..\lib\phobos.lib ..\lib\snn.lib russ.obj

        russ.obj: russ.d
                mars russ.d -I..\src\phobos

I get the following errors on the link:

        link ..\lib\phobos.lib ..\lib\snn.lib russ.obj
        OPTLINK (R) for Win32  Release 7.50B1
        Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

        ..\lib\snn.lib(stream)  Offset 3CFB1H Record Type 00C3
         Error 1: Previous Definition Different : ?WS  YAAAVistream  AAV1  Z
(istream &c
        decl WS(istream &))
        ..\lib\snn.lib(_wfopen)  Offset 51C1DH Record Type 00C3
         Error 1: Previous Definition Different : __WFOPEN
        ..\lib\snn.lib(wconstar)
         Error 42: Symbol Undefined _wmain
        ..\lib\snn.lib(wwinstar)
         Error 42: Symbol Undefined _wWinMain 16
        ..\lib\snn.lib(winstart)
         Error 42: Symbol Undefined _WinMain 16

        --- errorlevel 5

I have never used DM compilers before, so I downloaded dm823c.zip, extracted it,
dmdalpha.zip and extracted it, and then copied all the files in the dmd/
directory over into the corresponding ones in dm/

--
The Villagers are Online! http://villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]
Dec 08 2001
next sibling parent reply "Pavel Minayev" <evilone omen.ru> writes:
"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
news:3C12B2C8.949F65F3 deming-os.org...

 I get the following errors on the link:

         link ..\lib\phobos.lib ..\lib\snn.lib russ.obj
         OPTLINK (R) for Win32  Release 7.50B1
         Copyright (C) Digital Mars 1989 - 2001  All Rights Reserved

         ..\lib\snn.lib(stream)  Offset 3CFB1H Record Type 00C3
          Error 1: Previous Definition Different :
?WS YAAAVistream AAV1 Z

Use a different command to link OBJs:

    sc russ.obj

Works fine for me. I had modified the program a little:

    import stdio;

    class Foo
    {
     this() { printf("%p created\n", this); }
     ~this() { printf("%p destroyed\n", this); }
    }

    int main()
    {
     {
      Foo ptr = new Foo;
      printf("ptr %p out of scope\n", ptr);
      ptr = cast(Foo) null; // no effect
     }
     printf("waiting for gc...\n");
     for (long i = 0; i < 1000*1000; i++);
     printf("done\n");
     return 0;
    }

Now when I run it, Foo gets created but is never destroyed,
even with 1000000000 iterations of loop! Shouldn't the GC
run at the end of the program anyhow?

Also note one weird thing. null is a void*, and is incompatible
with any other pointers, requiring explicit cast! This should
definitely be changed...
Dec 09 2001
parent "Walter" <walter digitalmars.com> writes:
"Pavel Minayev" <evilone omen.ru> wrote in message
news:9uvcm8$2dng$1 digitaldaemon.com...
 Now when I run it, Foo gets created but is never destroyed,
 even with 1000000000 iterations of loop! Shouldn't the GC
 run at the end of the program anyhow?
It does now. <g>
 Also note one weird thing. null is a void*, and is incompatible
 with any other pointers, requiring explicit cast! This should
 definitely be changed...
Hmm. I've seen different positions on this!
Dec 09 2001
prev sibling parent reply "Walter" <walter digitalmars.com> writes:
"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
news:3C12B2C8.949F65F3 deming-os.org...
 Bug 0002: Link problems

 I compiled the following source file, wanting to test out how the GC
works:
         import stdio;

         class Foo
         {
           static this() { printf("%p ",this); }
The static is an error, it is now diagnosed.
           ~this () { printf("~%p ",this); }
         }

         int main()
         {
           {
             Foo ptr = new Foo;
             printf("x");
           }
           printf("x");
           long i;
           for(i=0; i<1000*1000*1000; i++);
Empty loops should be {}, this is now diagnosed.
           printf("x");
           return 0;
         }

 My makefile was as follows:

         russ.exe: russ.obj
                 link ..\lib\phobos.lib ..\lib\snn.lib russ.obj
This command will link in the entire libraries, instead of just searching them. Try: sc russ.obj to link.
Dec 09 2001
parent Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
Walter wrote:

 The static is an error, it is now diagnosed.
Yeah, that seemed odd, but I found that syntax in the sample a.d. So I guess it's an error there :)
 Empty loops should be {}, this is now diagnosed.
(slap forehead) Yeah, that was a requirement, wasn't it?
 This command will link in the entire libraries, instead of just searching
 them. Try:
     sc russ.obj
 to link.
Thanks! -- The Villagers are Online! http://villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]
Dec 09 2001
prev sibling next sibling parent reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
I tried to use the compiler to link in a .lib file with something I was
compiling, since I've seen that done on gcc.  I don't know if the DM d compiler
supports that sort of thing, but instead of reporting an error I get an "Illegal
Operation" window with the following line:

    mars russ.d -I..\src\phobos ..\lib\phobos.lib

--
The Villagers are Online! http://villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]
Dec 08 2001
next sibling parent "Pavel Minayev" <evilone omen.ru> writes:
"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
news:3C12B418.BF0C42F3 deming-os.org...

 I tried to use the compiler to link in a .lib file with something I was
 compiling, since I've seen that done on gcc.  I don't know if the DM d
compiler
 supports that sort of thing, but instead of reporting an error I get an
"Illegal
 Operation" window with the following line:

     mars russ.d -I..\src\phobos ..\lib\phobos.lib
It might have just treated the LIB file as a D program... probably not the best idea. Anyhow, you should do it when linking: mars russ.d -I..\src\phobos sc russ.obj phobos.lib
Dec 09 2001
prev sibling parent "Walter" <walter digitalmars.com> writes:
"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
news:3C12B418.BF0C42F3 deming-os.org...
 I tried to use the compiler to link in a .lib file with something I was
 compiling, since I've seen that done on gcc.  I don't know if the DM d
compiler
 supports that sort of thing, but instead of reporting an error I get an
"Illegal
 Operation" window with the following line:

     mars russ.d -I..\src\phobos ..\lib\phobos.lib
The mars executable doesn't handle the link step, you need to link separately using sc: sc russ.obj should do it.
Dec 09 2001
prev sibling parent reply "Pavel Minayev" <evilone omen.ru> writes:
Program consists of two files:

    // mod1.d
    import mod2;

    char[] name()
    {
     return "EvilOne";
    }

    int main(char[][] args)
    {
     greet();
    }


    // mod2.d
    import mod1;
    import stdio;

    void greet()
    {
     printf(name());
    }


First, I've compiled it as follows (repeating -I stuff omitted):

    > mars mod1.d mod2.d
    mod1.d(10): undefined identifier greet

OK, now vice-versa:

    > mars mod2.d mod1.d
    mod2.d(7): undefined identifier name

Then I decided to compile them separately:

    > mars mod1.d
!!!Works!!!
    > mars mod2.d
    Internal error: ..\ztc\cgcs.c 348

Here, the order doesn't matter. mod2 always fails to
compile. Wassup?
Dec 09 2001
parent reply "Pavel Minayev" <evilone omen.ru> writes:
Now even more funny. I've made all identifiers in mod1
fully qualified:

    // mod1.d, line 10
    mod2.greet();

Compiling:

    > mars mod1.d mod2.d
    mod1.d(10): undefined identifier
Expression::toCBuffer('import').greet.greet

?WHAT THE?
Dec 09 2001
parent "Walter" <walter digitalmars.com> writes:
Ok, these are fixed. -Walter

"Pavel Minayev" <evilone omen.ru> wrote in message
news:9uvct6$2dq0$1 digitaldaemon.com...
 Now even more funny. I've made all identifiers in mod1
 fully qualified:

     // mod1.d, line 10
     mod2.greet();

 Compiling:

     > mars mod1.d mod2.d
     mod1.d(10): undefined identifier
 Expression::toCBuffer('import').greet.greet

 ?WHAT THE?
Dec 09 2001
prev sibling next sibling parent reply Axel Kittenberger <axel dtone.org> writes:
Walter wrote:

 This is mainly to help along discussion of language features and to see
 what fundamental issues I've overlooked!
 
 ftp://ftp.digitalmars.com/dmdalpha.zip
 
 Enjoy.
Buck! The license in the download that seems to cover now this project doesn't look like something I like .... - Axel
Dec 09 2001
parent reply "Walter" <walter digitalmars.com> writes:
While I intend to do some sort of open source license in the future, for the
moment I think it's best that it be given some time to gel before multiple
incompatible versions appear <g>. A colleague of mine is investigating what
it would take to hook it up to GCC's back end.

"Axel Kittenberger" <axel dtone.org> wrote in message
news:9v0gf1$qt$1 digitaldaemon.com...
 Walter wrote:

 This is mainly to help along discussion of language features and to see
 what fundamental issues I've overlooked!

 ftp://ftp.digitalmars.com/dmdalpha.zip

 Enjoy.
Buck! The license in the download that seems to cover now this project doesn't look like something I like .... - Axel
Dec 09 2001
next sibling parent reply a <a b.c> writes:
Walter wrote:
 
 While I intend to do some sort of open source license in the future, for the
 moment I think it's best that it be given some time to gel before multiple
 incompatible versions appear <g>. A colleague of mine is investigating what
 it would take to hook it up to GCC's back end.
You'll have to let us know how that goes. Frankly, I'm not in the mood to buy, install and setup windows in a semi-comfortable manner just to test an alpha compiler. Dan
Dec 09 2001
next sibling parent reply Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
a wrote:

 You'll have to let us know how that goes.  Frankly, I'm not in the mood
 to buy, install and setup windows in a semi-comfortable manner just to
 test an alpha compiler.
I've got it copied over to my Linux box to try it out with Wine. Trouble is, I've never used Wine before...and I don't have it configured properly yet. Speaking of which...is mars.exe specifically a Windows executable, or might it be worth trying in the Linux DOS Emulator (dosemu). Ofc, Walter, I don't expect you to support running your compiler under Wine...but I am very curious about whether it might work or not :) -- The Villagers are Online! http://villagersonline.com .[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ] .[ (a version.of(English).(precise.more)) is(possible) ] ?[ you want.to(help(develop(it))) ]
Dec 09 2001
next sibling parent "Walter" <walter digitalmars.com> writes:
It's specifically a Win32 executable, not a DOS one. It doesn't push the API
very hard, so if Wine works at all, then mars.exe should <g>.


"Russ Lewis" <spamhole-2001-07-16 deming-os.org> wrote in message
news:3C1429BB.ED2E6D27 deming-os.org...
 Speaking of which...is mars.exe specifically a Windows executable, or
might it be
 worth trying in the Linux DOS Emulator (dosemu).

 Ofc, Walter, I don't expect you to support running your compiler under
Wine...but I
 am very curious about whether it might work or not :)
Dec 09 2001
prev sibling parent reply Christof Meerwald <cmeerw web.de> writes:
On Sun, 09 Dec 2001 20:19:23 -0700, Russ Lewis wrote:
 Ofc, Walter, I don't expect you to support running your compiler under
Wine...but I
 am very curious about whether it might work or not :)
It does work with Wine (at least with Wine-20011108) You only have to make sure that all filenames are in lowercase only (if you want to install DM on a case-sensitive filesystem like ext2) And you have to use "--" on the wine command line to make wine stop parsing command line options, e.g. use wine -- c:/dmd/bin/mars -o sieve.d instead of wine c:/dmd/bin/mars -o sieve.d bye, Christof -- http://cmeerw.cjb.net JID: cmeerw jabber.at mailto cmeerw at web.de ...and what have you contributed to the Net?
Dec 15 2001
parent "Walter" <walter digitalmars.com> writes:
Cool!

"Christof Meerwald" <cmeerw web.de> wrote in message
news:9vfoo4$ms4$1 digitaldaemon.com...
 On Sun, 09 Dec 2001 20:19:23 -0700, Russ Lewis wrote:
 Ofc, Walter, I don't expect you to support running your compiler under
Wine...but I
 am very curious about whether it might work or not :)
It does work with Wine (at least with Wine-20011108) You only have to make sure that all filenames are in lowercase only (if
you
 want to install DM on a case-sensitive filesystem like ext2)

 And you have to use "--" on the wine command line to make wine stop
parsing
 command line options, e.g. use

   wine -- c:/dmd/bin/mars -o sieve.d

 instead of

   wine c:/dmd/bin/mars -o sieve.d


 bye, Christof

 --
 http://cmeerw.cjb.net                             JID: cmeerw jabber.at
 mailto cmeerw at web.de

 ...and what have you contributed to the Net?
Dec 15 2001
prev sibling parent "Walter" <walter digitalmars.com> writes:
"a" <a b.c> wrote in message news:3C14164B.913EF689 b.c...
 Walter wrote:
 While I intend to do some sort of open source license in the future, for
the
 moment I think it's best that it be given some time to gel before
multiple
 incompatible versions appear <g>. A colleague of mine is investigating
what
 it would take to hook it up to GCC's back end.
You'll have to let us know how that goes. Frankly, I'm not in the mood to buy, install and setup windows in a semi-comfortable manner just to test an alpha compiler.
I wouldn't expect anyone to. -Walter
Dec 09 2001
prev sibling parent reply Axel Kittenberger <axel dtone.org> writes:
Walter wrote:

 While I intend to do some sort of open source license in the future, for
 the moment I think it's best that it be given some time to gel before
 multiple incompatible versions appear <g>. A
I work now a while in the OpenSource Environment, there might be valid concerns I do understand (If you want to make money/finance yourself) but this particular one of multiple version is in practise baseless, never underestimate the power of the "official" distribution. Beeing on the other side I know how few chamces one has at the community maintainting an non official version of an OpenSource Package. I would suggest distiebuting under GPL (also your libraries) or one of the very GPL-like licenses as this gives commercial competiton great drawbacks as they have to publicate their modifications, or globassy have to move one of their applications to GPL if they use your library. Then require from patch contributions a copyright assignment like the GPL does (and some other projects mainly backed by companies (meaning most of the devs work there)), this allows -you- to link the code against your libraries without having to OpenSoure them, allows you to sell superceded version parallell to the GPL version (ie QT) allows you to sell the GPL libraries with a non GPL license for people who want to pay for nat having to transiest to GPL (see sleepycat.com and their buisness model)
 colleague of mine is investigating what it would take to hook it up to
 GCC's back end.
GPL, or until your willing to workaround with files. However the FSF is doing pretty strong politics with gcc, and it has its reason why the GCC companents are interwoven with each other, and do no longer work on file interfacing, so they are able to force all frontends to be GPL or having to do pretty unpleasing workarounds (I do not yet know of any)
Dec 10 2001
parent Axel Kittenberger <axel dtone.org> writes:
 one of their applications to GPL if they use your library. Then require
 from patch contributions a copyright assignment like the GPL does (and
A painfull error, of course I mean ... assignment like the *FSF* does Generally sorry for the aou mismatches I'm currently playing with Dvorak keyboard layout... - Axel
Dec 10 2001
prev sibling parent Russ Lewis <spamhole-2001-07-16 deming-os.org> writes:
It's kind of a triviality, but gcc's -MM (list includes) is very useful to me.
Having that work on the D compiler would be a high priority for me :)

--
The Villagers are Online! http://villagersonline.com

.[ (the fox.(quick,brown)) jumped.over(the dog.lazy) ]
.[ (a version.of(English).(precise.more)) is(possible) ]
?[ you want.to(help(develop(it))) ]
Dec 09 2001