December 23, 2010
Andrei Alexandrescu wrote:
> I think the bread and butter support
> is as rock solid in both languages.

I agree. For my day to day work, I'm pretty conservative in the use of the language; 90% of my code is probably best characterized as "a better C".

Interestingly though, I use a template of some sort about once every five lines... Variant.get, std.conv.to, my own mysql.query, and several other little ones get heavy, but discreet use.)

Anyway, I very rarely encounter D bugs in any of the code, and virtually never in that simpler bulk of it. The edges may be rough, but the core kicks ass.

I've spent less time fighting bugs in the last year of D than I did reading php.net/strpos and php.net/str_replace in the previous year of PHP!
December 23, 2010
You got me excited, so I decided to give GDC another try.  I cloned the
repo, and using GCC 4.4.5, it compiled without errors.
I started following the examples in TDPL, but the Stat program on page 22
gives the following errors:

t1.d:33: Error: void has no value
t1.d:33: Error: incompatible types for ((readf(" %s ",& x)) == (1)): 'void'
and 'int'

is there a typo in the code, or is this some kind of bug in GDC?

On Thu, Dec 23, 2010 at 3:16 PM, Jonathan M Davis <jmdavisProg@gmx.com>wrote:

> On Thursday 23 December 2010 12:43:11 Thomas Mader wrote:
> > Am 2010-12-23 21:01, schrieb spir:
> > > On Thu, 23 Dec 2010 17:41:06 +0100
> > >
> > > Thomas Mader<thomas.mader@gmail.com>  wrote:
> > >> I think it's very important for D to step into the corporate world to get more stability, a bigger community and therefore a stronger toolchain. For this to happen companies need trust in the future of
> the
> > >> project and the future are the people and the infrastructure behind D.
> > >
> > > This is true, but having important corporate investment would also strongly freeze the language in a premature state. It's too early (for D2).
> > >
> > > Denis
> > > -- -- -- -- -- -- --
> > > vit esse estrany ☣
> > >
> > > spir.wikidot.com
> >
> > I agree but I must confess that I'm confused about the state of D2. It's said that for new projects someone should use D2 but I often recognize that it is not considered ready/finished yet. On the other hand I also read somewhere that with the release of the book "The D programming language" D2 is finalized?
> >
> > Can somebody please enlighten me on this?
>
> With the release of TDPL, the D spec is no longer undergoing massive
> changes
> with each release. It is mostly finalized. However, there have been some
> issues
> that have come up or which were not 100% sorted out prior to TDPL being
> released, so some changes to the spec may be made. They will, however, only
> be
> made as necessary, and there shouldn't be very many of them. Also, they'd
> mostly
> deal with fancier features such as inout or alias this.
>
> That being said, regardless of the state of the spec, there's the state of
> the
> compiler and the standard libraries. The compiler continues to progress,
> but it
> has plenty of bugs in it still, and it has yet to implement everything in
> TDPL
> (e.g. you can currently only have one alias this per class or struct
> instead of
> multiple like TDPL says), though it has implemented almost all of it. The
> compiler is stable enough that you should be able to write code in it -
> even for
> larger projects - just fine. But you will run into bugs. So, if you want
> rock-
> solid stability, then it's not up-to-snuff yet. But it works quite well
> overall,
> and many consider the benefits to far outweigh the problems. And the
> compiler
> continues to improve with each release, so the number of problems is
> diminishing.
>
> Phobos, however, continues to be in flux and is definitely not finalized.
> Much of
> it is pretty fixed and won't be undergoing major changes, but other parts
> will
> continue to change as development continues. Some modules will be removed
> (though not many) and others will be added. The release of TDPL did not
> indicate
> the finalization of Phobos at all. Phobos is very much still a work in
> progress.
> So, while you can mostly rely on it not changing enough to force you to
> change
> code with a new compiler release, it definitely does happen at least some
> of the
> time.
>
> So, D2 is definitely ready for use, but it's still rough around the edges.
> Whether it's appropriate or not far a particular project likely depends on
> how
> mission critical the project is.
>
> - Jonathan M Davis
>


December 23, 2010
== Quote from Caligo (iteronvexor@gmail.com)'s article
> --001636e0a9cc00219904981c2ad9
> Content-Type: text/plain; charset=UTF-8
> Content-Transfer-Encoding: quoted-printable
> You got me excited, so I decided to give GDC another try.  I cloned the
> repo, and using GCC 4.4.5, it compiled without errors.
> I started following the examples in TDPL, but the Stat program on page 22
> gives the following errors:
> t1.d:33: Error: void has no value
> t1.d:33: Error: incompatible types for ((readf(" %s ",& x)) =3D=3D (1)): 'v=
> oid'
> and 'int'
> is there a typo in the code, or is this some kind of bug in GDC?

Hard to say without the code example, however, what I can say is that the error is emitted from the DMD frontend, and not the GDC glue/GCC backend.

Regards
December 23, 2010
== Quote from Iain Buclaw (ibuclaw@ubuntu.com)'s article
> == Quote from Caligo (iteronvexor@gmail.com)'s article
> > --001636e0a9cc00219904981c2ad9
> > Content-Type: text/plain; charset=UTF-8
> > Content-Transfer-Encoding: quoted-printable
> > You got me excited, so I decided to give GDC another try.  I cloned the
> > repo, and using GCC 4.4.5, it compiled without errors.
> > I started following the examples in TDPL, but the Stat program on page 22
> > gives the following errors:
> > t1.d:33: Error: void has no value
> > t1.d:33: Error: incompatible types for ((readf(" %s ",& x)) =3D=3D (1)): 'v=
> > oid'
> > and 'int'
> > is there a typo in the code, or is this some kind of bug in GDC?
> Hard to say without the code example, however, what I can say is that the error
> is emitted from the DMD frontend, and not the GDC glue/GCC backend.
> Regards

Looking at phobos, I see this:

void readf(A...)(in char[] format, A args)


Regards
December 23, 2010
On 12/24/10, Caligo <iteronvexor@gmail.com> wrote:
> You got me excited, so I decided to give GDC another try.  I cloned the
> repo, and using GCC 4.4.5, it compiled without errors.
> I started following the examples in TDPL, but the Stat program on page 22
> gives the following errors:
>
> t1.d:33: Error: void has no value
> t1.d:33: Error: incompatible types for ((readf(" %s ",& x)) == (1)): 'void'
> and 'int'
>
> is there a typo in the code, or is this some kind of bug in GDC?

Use stdin.readf:

import std.exception, std.stdio;
void main(string[] args) {
  for (double x; stdin.readf(" %s ", &x) == 1; ) {
  }
}

The TDPL errata is here btw, that bug is listed: http://erdani.com/tdpl/errata/index.php?title=Main_Page
December 23, 2010
On 12/24/10, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:
> Use stdin.readf:

And don't forget to catch those exceptions!

import std.exception, std.stdio, std.conv;

void main(string[] args)
{
    try
    {
        for (double x; stdin.readf(" %s ", &x) == 1;)
        {
            writeln(x); // or was it stat.postprocess? :)
        }
    }
    catch (ConvException)
    {
    }
}

That should do it.
December 23, 2010
On Thu, Dec 23, 2010 at 5:38 PM, Andrej Mitrovic <andrej.mitrovich@gmail.com
> wrote:

> On 12/24/10, Caligo <iteronvexor@gmail.com> wrote:
> > You got me excited, so I decided to give GDC another try.  I cloned the
> > repo, and using GCC 4.4.5, it compiled without errors.
> > I started following the examples in TDPL, but the Stat program on page 22
> > gives the following errors:
> >
> > t1.d:33: Error: void has no value
> > t1.d:33: Error: incompatible types for ((readf(" %s ",& x)) == (1)):
> 'void'
> > and 'int'
> >
> > is there a typo in the code, or is this some kind of bug in GDC?
>
> Use stdin.readf:
>
> import std.exception, std.stdio;
> void main(string[] args) {
>  for (double x; stdin.readf(" %s ", &x) == 1; ) {
>  }
> }
>
> The TDPL errata is here btw, that bug is listed: http://erdani.com/tdpl/errata/index.php?title=Main_Page
>


great, that fixed the problem.  I was actually trying to find the errata too, so thanks for that.

The example compiles but it throws an exception:

>> echo 3 4 6.6 7.7 33.4 | ./t1 Min Max Average
object.Exception@3030object.Exception@30


December 24, 2010
On 12/23/10 5:50 PM, Caligo wrote:
>
>
> On Thu, Dec 23, 2010 at 5:38 PM, Andrej Mitrovic
> <andrej.mitrovich@gmail.com <mailto:andrej.mitrovich@gmail.com>> wrote:
>
>     On 12/24/10, Caligo <iteronvexor@gmail.com
>     <mailto:iteronvexor@gmail.com>> wrote:
>      > You got me excited, so I decided to give GDC another try.  I
>     cloned the
>      > repo, and using GCC 4.4.5, it compiled without errors.
>      > I started following the examples in TDPL, but the Stat program on
>     page 22
>      > gives the following errors:
>      >
>      > t1.d:33: Error: void has no value
>      > t1.d:33: Error: incompatible types for ((readf(" %s ",& x)) ==
>     (1)): 'void'
>      > and 'int'
>      >
>      > is there a typo in the code, or is this some kind of bug in GDC?
>
>     Use stdin.readf:
>
>     import std.exception, std.stdio;
>     void main(string[] args) {
>       for (double x; stdin.readf(" %s ", &x) == 1; ) {
>       }
>     }
>
>     The TDPL errata is here btw, that bug is listed:
>     http://erdani.com/tdpl/errata/index.php?title=Main_Page
>
>
>
> great, that fixed the problem.  I was actually trying to find the errata
> too, so thanks for that.
>
> The example compiles but it throws an exception:
>
>  >> echo 3 4 6.6 7.7 33.4 | ./t1 Min Max Average
> object.Exception@3030object.Exception@30

Would you mind posting the entire code? Thanks.

Andrei
December 24, 2010
I hope I didn't miss anything; I copied it from the book.

import std.stdio, std.exception;

interface Stat{
    void accumulate(double x);
    void postprocess();
    double result();
}

class Min : Stat{
    private double min = double.max;
    void accumulate(double x){
        if( x < min ){
        min = x;
        }
    }

    void postprocess(){ }
    double result(){
        return min;
    }
}

void main(string[] args){

     Stat[] stats;
     foreach(arg; args[1 .. $]){
               auto newStat = cast(Stat) Object.factory("stats." ~ arg);
          enforce(newStat, "Invalid statistics function: " ~ arg);
          stats ~= newStat;
      }
      for(double x; stdin.readf(" %s ", &x) == 1; ){
               foreach(s; stats){
                 s.accumulate(x);
        }
       }
      foreach(s; stats){
               s.postprocess();
         writeln(s.result());
      }
}


On Thu, Dec 23, 2010 at 6:04 PM, Andrei Alexandrescu < SeeWebsiteForEmail@erdani.org> wrote:

> On 12/23/10 5:50 PM, Caligo wrote:
>
>>
>>
>> On Thu, Dec 23, 2010 at 5:38 PM, Andrej Mitrovic <andrej.mitrovich@gmail.com <mailto:andrej.mitrovich@gmail.com>> wrote:
>>
>>    On 12/24/10, Caligo <iteronvexor@gmail.com
>>    <mailto:iteronvexor@gmail.com>> wrote:
>>     > You got me excited, so I decided to give GDC another try.  I
>>    cloned the
>>     > repo, and using GCC 4.4.5, it compiled without errors.
>>     > I started following the examples in TDPL, but the Stat program on
>>    page 22
>>     > gives the following errors:
>>     >
>>     > t1.d:33: Error: void has no value
>>     > t1.d:33: Error: incompatible types for ((readf(" %s ",& x)) ==
>>    (1)): 'void'
>>     > and 'int'
>>     >
>>     > is there a typo in the code, or is this some kind of bug in GDC?
>>
>>    Use stdin.readf:
>>
>>    import std.exception, std.stdio;
>>    void main(string[] args) {
>>      for (double x; stdin.readf(" %s ", &x) == 1; ) {
>>      }
>>    }
>>
>>    The TDPL errata is here btw, that bug is listed:
>>    http://erdani.com/tdpl/errata/index.php?title=Main_Page
>>
>>
>>
>> great, that fixed the problem.  I was actually trying to find the errata
>>
>> too, so thanks for that.
>>
>> The example compiles but it throws an exception:
>>
>>  >> echo 3 4 6.6 7.7 33.4 | ./t1 Min Max Average
>> object.Exception@3030object.Exception@30
>>
>
> Would you mind posting the entire code? Thanks.
>
> Andrei
>


December 24, 2010
On 12/23/10 6:11 PM, Caligo wrote:
> I hope I didn't miss anything; I copied it from the book.

Looking good, I reproduced the exception as a miscommunication between readf and parse. Give me a little time to look into this.

Andrei