www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - TDPL Errata site is down

reply Andrej Mitrovic <and.mitrovic hotmail.com> writes:
Or, it has some database problems. 

http://erdani.com/tdpl/errata/index.php?title=Errata_for_%22The_D_Programming_Language%22_book

Luckily the cached version works fine:
http://webcache.googleusercontent.com/search?q=cache:nIyQeOaM1hAJ:erdani.com/tdpl/errata/index.php%3Ftitle%3DErrata_for_%2522The_D_Programming_Language%2522_book+the+d+programming+language+errata&cd=3&hl=en&ct=clnk
Jul 23 2010
parent reply Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
Andrej Mitrovic wrote:
 Or, it has some database problems. 
 
 http://erdani.com/tdpl/errata/index.php?title=Errata_for_%22The_D_Programming_Language%22_book
 
 Luckily the cached version works fine:
 http://webcache.googleusercontent.com/search?q=cache:nIyQeOaM1hAJ:erdani.com/tdpl/errata/index.php%3Ftitle%3DErrata_for_%2522The_D_Programming_Language%2522_book+the+d+programming+language+errata&cd=3&hl=en&ct=clnk

Yes, I noticed only this morning. Thanks! The database is gone, but I saved the google cache of the errata and will reenter the data tonite. Thanks again, Andrei
Jul 23 2010
next sibling parent reply Andrej Mitrovic <and.mitrovic hotmail.com> writes:
Andrei Alexandrescu Wrote:

 Andrej Mitrovic wrote:
 Or, it has some database problems. 
 
 http://erdani.com/tdpl/errata/index.php?title=Errata_for_%22The_D_Programming_Language%22_book
 
 Luckily the cached version works fine:
 http://webcache.googleusercontent.com/search?q=cache:nIyQeOaM1hAJ:erdani.com/tdpl/errata/index.php%3Ftitle%3DErrata_for_%2522The_D_Programming_Language%2522_book+the+d+programming+language+errata&cd=3&hl=en&ct=clnk

Yes, I noticed only this morning. Thanks! The database is gone, but I saved the google cache of the errata and will reenter the data tonite. Thanks again, Andrei

No problem :) Btw, where can we ask questions regarding the examples in the book? There's this line on page 11: assert(binarySearch!(int)([1, 3, 6, 7, 9, 15], 6)); But I'm getting a compiler error: binarysearch1.d(21): Error: template binarysearch1.binarySearch(T) does not match any function template declaration binarysearch1.d(21): Error: template binarysearch1.binarySearch(T) cannot deduce template function from argument types !()(bool,int) That should work with the example code, right?
Jul 23 2010
parent Andrej Mitrovic <and.mitrovic hotmail.com> writes:
Andrej Mitrovic Wrote:

 Andrei Alexandrescu Wrote:
 
 Andrej Mitrovic wrote:
 Or, it has some database problems. 
 
 http://erdani.com/tdpl/errata/index.php?title=Errata_for_%22The_D_Programming_Language%22_book
 
 Luckily the cached version works fine:
 http://webcache.googleusercontent.com/search?q=cache:nIyQeOaM1hAJ:erdani.com/tdpl/errata/index.php%3Ftitle%3DErrata_for_%2522The_D_Programming_Language%2522_book+the+d+programming+language+errata&cd=3&hl=en&ct=clnk

Yes, I noticed only this morning. Thanks! The database is gone, but I saved the google cache of the errata and will reenter the data tonite. Thanks again, Andrei

No problem :) Btw, where can we ask questions regarding the examples in the book? There's this line on page 11: assert(binarySearch!(int)([1, 3, 6, 7, 9, 15], 6)); But I'm getting a compiler error: binarysearch1.d(21): Error: template binarysearch1.binarySearch(T) does not match any function template declaration binarysearch1.d(21): Error: template binarysearch1.binarySearch(T) cannot deduce template function from argument types !()(bool,int) That should work with the example code, right?

Ouch! That wasn't the error, it was the line before it, specifically the second line here: assert(binarySearch([1, 3, 6, 7, 9, 15], 6)); assert(binarySearch(![1, 3, 6, 7, 9, 15], 5)); assert(binarySearch!(int)([1, 3, 6, 7, 9, 15], 6)); I put the exclamation mark in the wrong position. Doh!(!). :p
Jul 23 2010
prev sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
I can't compile the stats example, it uses readf() (on page 22), but the
compiler complains that it's undefined. I found readf() in the library under
std.stream, but importing that won't work. I'm using DMD 2.047.

Andrei Alexandrescu Wrote:

 Andrej Mitrovic wrote:
 Or, it has some database problems. 
 
 http://erdani.com/tdpl/errata/index.php?title=Errata_for_%22The_D_Programming_Language%22_book
 
 Luckily the cached version works fine:
 http://webcache.googleusercontent.com/search?q=cache:nIyQeOaM1hAJ:erdani.com/tdpl/errata/index.php%3Ftitle%3DErrata_for_%2522The_D_Programming_Language%2522_book+the+d+programming+language+errata&cd=3&hl=en&ct=clnk

Yes, I noticed only this morning. Thanks! The database is gone, but I saved the google cache of the errata and will reenter the data tonite. Thanks again, Andrei

Jul 25 2010
parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Here's some more for the Errata (I've checked against the cached one):

Page 26: "In D, slicing could never occur."
    This should probably be "In D slicing, this could never occur."


Page 50: "If the indexing expression is on the left-hand side of an assignment
operation (e.g., arr[i] = e) and a is an associative array.."    
    'arr' is an associative array, not 'a'


Page 57: "a is c || writefln("Indeed... not the same");"
    Replace writefln with writeln


Page 59: "line.length > 0 || line = "\n"; 
    Compiler error:
    cannot implicitly convert expression ("\x0a") of type string to bool

Andrej Mitrovic Wrote:

 I can't compile the stats example, it uses readf() (on page 22), but the
compiler complains that it's undefined. I found readf() in the library under
std.stream, but importing that won't work. I'm using DMD 2.047.
 
 Andrei Alexandrescu Wrote:
 
 Andrej Mitrovic wrote:
 Or, it has some database problems. 
 
 http://erdani.com/tdpl/errata/index.php?title=Errata_for_%22The_D_Programming_Language%22_book
 
 Luckily the cached version works fine:
 http://webcache.googleusercontent.com/search?q=cache:nIyQeOaM1hAJ:erdani.com/tdpl/errata/index.php%3Ftitle%3DErrata_for_%2522The_D_Programming_Language%2522_book+the+d+programming+language+errata&cd=3&hl=en&ct=clnk

Yes, I noticed only this morning. Thanks! The database is gone, but I saved the google cache of the errata and will reenter the data tonite. Thanks again, Andrei


Jul 26 2010
next sibling parent reply Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Another one:

Page 76:
    The second foreach example with the ref symbol which has the wrong type
compiles without an error (it should not).
    What is also weird is that the values are left unchanged:
        float[] arr = [1.0, 2.5, 4.0];
        foreach (ref double elem; arr) {
            elem /= 2;
            writeln(elem);
        }
        writeln(arr);
        
    Prints out:
        0.5
        1.25
        2
        1 2.5 4

I think this should go into the bug tracker for DMD?

Andrej Mitrovic Wrote:

 Here's some more for the Errata (I've checked against the cached one):
 
 Page 26: "In D, slicing could never occur."
     This should probably be "In D slicing, this could never occur."
 
 
 Page 50: "If the indexing expression is on the left-hand side of an assignment
operation (e.g., arr[i] = e) and a is an associative array.."    
     'arr' is an associative array, not 'a'
 
 
 Page 57: "a is c || writefln("Indeed... not the same");"
     Replace writefln with writeln
 
 
 Page 59: "line.length > 0 || line = "\n"; 
     Compiler error:
     cannot implicitly convert expression ("\x0a") of type string to bool
 
 Andrej Mitrovic Wrote:
 
 I can't compile the stats example, it uses readf() (on page 22), but the
compiler complains that it's undefined. I found readf() in the library under
std.stream, but importing that won't work. I'm using DMD 2.047.
 
 Andrei Alexandrescu Wrote:
 
 Andrej Mitrovic wrote:
 Or, it has some database problems. 
 
 http://erdani.com/tdpl/errata/index.php?title=Errata_for_%22The_D_Programming_Language%22_book
 
 Luckily the cached version works fine:
 http://webcache.googleusercontent.com/search?q=cache:nIyQeOaM1hAJ:erdani.com/tdpl/errata/index.php%3Ftitle%3DErrata_for_%2522The_D_Programming_Language%2522_book+the+d+programming+language+errata&cd=3&hl=en&ct=clnk

Yes, I noticed only this morning. Thanks! The database is gone, but I saved the google cache of the errata and will reenter the data tonite. Thanks again, Andrei



Jul 26 2010
parent reply bearophile <bearophileHUGS lycos.com> writes:
Andrej Mitrovic:

     The second foreach example with the ref symbol which has the wrong type
compiles without an error (it should not).

It's a bug (keyword: accepts-invalid), put it in Bugzilla if not already present.
     What is also weird is that the values are left unchanged:

It is code that can't compile, so what it does is undefined behaviour :-) Bye, bearophile
Jul 26 2010
parent Andrej Mitrovic <andrej.mitrovich gmail.com> writes:
Ok. It's in the bugzilla:
http://d.puremagic.com/issues/show_bug.cgi?id=4510

There's a similar bug here as well:
http://d.puremagic.com/issues/show_bug.cgi?id=3290


bearophile Wrote:

 Andrej Mitrovic:
 
     The second foreach example with the ref symbol which has the wrong type
compiles without an error (it should not).

It's a bug (keyword: accepts-invalid), put it in Bugzilla if not already present.
     What is also weird is that the values are left unchanged:

It is code that can't compile, so what it does is undefined behaviour :-) Bye, bearophile

Jul 26 2010
prev sibling next sibling parent reply "Joel C. Salomon" <joelcsalomon gmail.com> writes:
Looking through the TDPL errata I came across this:

On 07/26/2010 11:15 AM, Andrej Mitrovic wrote:
 Here's some more for the Errata (I've checked against the cached one):
 
 Page 26: "In D, slicing could never occur."
     This should probably be "In D slicing, this could never occur."

Actually, this is not talking about D’s (array) slicing but C++’s (object) slicing. The line should read as is, or as, “In D, such slicing could …”; perhaps with the word “slicing” in quotes to distinguish it from other uses of the word elsewhere. —Joel
Oct 24 2010
next sibling parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
On 10/24/10 7:17 CDT, Joel C. Salomon wrote:
 Looking through the TDPL errata I came across this:

 On 07/26/2010 11:15 AM, Andrej Mitrovic wrote:
 Here's some more for the Errata (I've checked against the cached one):

 Page 26: "In D, slicing could never occur."
      This should probably be "In D slicing, this could never occur."

Actually, this is not talking about Ds (array) slicing but C++s (object) slicing. The line should read as is, or as, In D, such slicing could ; perhaps with the word slicing in quotes to distinguish it from other uses of the word elsewhere. Joel

Thanks! Will fix. Andrei
Oct 24 2010
prev sibling parent Ellery Newcomer <ellery-newcomer utulsa.edu> writes:
On 10/24/2010 04:36 PM, retard wrote:
 Walter has many times mentioned how segfaults are actually better than
 exceptions. They force you to fix your code and the debugger is halfway
 built in the CPU and operating system.

null dereference exploits notwithstanding?
Oct 24 2010
prev sibling next sibling parent Jonathan M Davis <jmdavisProg gmx.com> writes:
On Sunday 24 October 2010 05:17:30 Joel C. Salomon wrote:
 Looking through the TDPL errata I came across this:
=20
 On 07/26/2010 11:15 AM, Andrej Mitrovic wrote:
 Here's some more for the Errata (I've checked against the cached one):
=20
 Page 26: "In D, slicing could never occur."
=20
     This should probably be "In D slicing, this could never occur."

Actually, this is not talking about D=E2=80=99s (array) slicing but C++=

 (object) slicing.  The line should read as is, or as, =E2=80=9CIn D, such
 slicing could =E2=80=A6=E2=80=9D; perhaps with the word =E2=80=9Cslicing=

 distinguish it from other uses of the word elsewhere.
=20
 =E2=80=94Joel

LOL. Yes, in D, slicing is a _good_ thing, whereas in C++, it's a problem t= o=20 watch out for. Now if only we'd found some cool feature that could have bee= n=20 called segmentation fault... ;) =2D Jonathan M Davis
Oct 24 2010
prev sibling parent retard <re tard.com.invalid> writes:
Sun, 24 Oct 2010 14:17:53 -0700, Jonathan M Davis wrote:

 On Sunday 24 October 2010 05:17:30 Joel C. Salomon wrote:
 Looking through the TDPL errata I came across this:
 
 On 07/26/2010 11:15 AM, Andrej Mitrovic wrote:
 Here's some more for the Errata (I've checked against the cached
 one):
 
 Page 26: "In D, slicing could never occur."
 
     This should probably be "In D slicing, this could never occur."

Actually, this is not talking about D’s (array) slicing but C++’s (object) slicing. The line should read as is, or as, “In D, such slicing could …”; perhaps with the word “slicing” in quotes to distinguish it from other uses of the word elsewhere. —Joel

LOL. Yes, in D, slicing is a _good_ thing, whereas in C++, it's a problem to watch out for. Now if only we'd found some cool feature that could have been called segmentation fault... ;)

Walter has many times mentioned how segfaults are actually better than exceptions. They force you to fix your code and the debugger is halfway built in the CPU and operating system.
Oct 24 2010