www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Trying to compile sample from The D Programming Language book.

reply Junior <jeezusjr gmail.com> writes:
Hello, I am completely stuck on this error, any help would be appreciated...
google was not helpful (too many useless matches for "D <error>").

I am trying to compile this:

import std.string, std.algorithm, std.conv, std.ctype, std.regex, std.range,
// blah blah blah
auto words = split(sentence, regex("[ \t,.;:?]+"));
// blah blah blah

and two compilers (gdc, dmd) are giving me this error (output from gdc):

main.d:34: Error: std.string.split at
conflicts with std.regex.split(String) at

And I am clueless. How can they conflict, it's the standard library. It must
be in the usage of split. As this is the second or third example in chapter
one, I have no clue what is going on.

Apr 03 2011
parent Jesus Alvarez <jeezusjr gmail.com> writes:
I got it to compile adding std.regex to split to make it:

auto words = std.regex.split (sentence, regex("[ \t,.;:?]+"));

So now my question is, is this an error in the book? The errata doesn't
mention anything about this section. Why do I have to prepend std.regex?

Apr 03 2011