problems with DPL example.

2011-10-10 Thread %u
Hello. I'm having problems compiling the following: // From chapter 1 of D Programming Language. // import std.stdio, std.string; void main() { uint[string] dictionary; foreach( line; stdin.byLine()) { // Break sentence into words // Add each word in the sentence to the vocabulary

Re: problems with DPL example.

2011-10-10 Thread simendsjo
On 10.10.2011 19:55, %u wrote: Hello. I'm having problems compiling the following: // From chapter 1 of D Programming Language. // import std.stdio, std.string; void main() { uint[string] dictionary; foreach( line; stdin.byLine()) { // Break sentence into words // Add each

Re: problems with DPL example.

2011-10-10 Thread Justin Whear
You need to create an immutable copy of word before using it as a key. That is, replace this line: dictionary[word] = newID; with dictionary[word.idup] = newID;

Re: problems with DPL example.

2011-10-10 Thread bearophile
%u: Decho hello | wordcount2.exe wordcount2.d 0 hello std.stdio.StdioException@std\stdio.d(2156): Bad file descriptor Try: wordcount2.exe wordcount2.d Bye, bearophile

Re: problems with DPL example.

2011-10-10 Thread simendsjo
On 10.10.2011 21:38, bearophile wrote: %u: Decho hello | wordcount2.exe wordcount2.d 0 hello std.stdio.StdioException@std\stdio.d(2156): Bad file descriptor Try: wordcount2.exe wordcount2.d Bye, bearophile Shouldn't the original way work too? Another point: I recommend compiling

Re: problems with DPL example.

2011-10-10 Thread %u
== Quote from bearophile (bearophileh...@lycos.com)'s article simendsjo: Shouldn't the original way work too? I don't remember. Another point: I recommend compiling with debug symbols as it gives you a nice stacktrace. I think debug symbols should be present on default, to produce a nice

Re: problems with DPL example.

2011-10-10 Thread Jonathan M Davis
You should checkout out this page: http://erdani.com/tdpl/errata/ - Jonathan M Davis

Re: ref struct?

2011-10-10 Thread bearophile
Andrej Mitrovic: I think this is what refcounted structs are for. ref structs are regular heap-allocated GC-managed structs, but they are managed by reference instead of by pointer. So refcounting is not significant here. -- Jonathan M Davis: That or make it a

Re: ref struct?

2011-10-10 Thread Andrej Mitrovic
On 10/11/11, bearophile bearophileh...@lycos.com wrote: Andrej Mitrovic: I think this is what refcounted structs are for. ref structs are regular heap-allocated GC-managed structs, but they are managed by reference instead of by pointer. So refcounting is not significant here. But can't

indexing php

2011-10-10 Thread sclytrack
Every time I press on the D via web browser I get wanna download indexing dot php while D.learn works without problem.