www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - std.net.curl broken?

reply Benjamin Thaut <code benjamin-thaut.de> writes:
I just wanted to get the contents of a smiple html page using 
std.net.curl (on Windows)

So I did (exactly like in the library documentation example)

string contents = get("dlang.org");

But this won't even compile, not with dmd 2.062 and not with 2.063

main.d(8): Error: cannot implicitly convert expression (get("dlang.org", 
AutoProtocol())) of type char[] to string
C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\range.d(611): 
Error: static assert  "Cannot put a const(dchar)
into a Appender!(char[])"
C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\format.d(2160): 

instantiated from here: put!(Appender!(char[]), const(dchar))
C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\format.d(2207): 

instantiated from here: formatChar!(Appender!(char[]))
C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\typecons.d(581): 

instantiated from here: formatElement!(Appender!(string), char[], char)
C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\net\curl.d(1873): 
        ... (4 instantiations, -v to show) ...
C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\net\curl.d(374): 

instantiated from here: get!(FTP, char)
main.d(8):
instantiated from here: get!(AutoProtocol, char)


Are the exampels not tested? What is wrong here?

Kind Regards
Benjamin Thaut
Jun 23 2013
next sibling parent "Vladimir Panteleev" <vladimir thecybershadow.net> writes:
On Sunday, 23 June 2013 at 12:08:08 UTC, Benjamin Thaut wrote:
 I just wanted to get the contents of a smiple html page using 
 std.net.curl (on Windows)

 So I did (exactly like in the library documentation example)

 string contents = get("dlang.org");
Looks like a documentation bug. `get("dlang.org")` will return a char[], not a string. The unrelated errors in std.range an std.format are caused by a DMD bug (7904, I believe).
Jun 23 2013
prev sibling parent Benjamin Thaut <code benjamin-thaut.de> writes:
Am 23.06.2013 14:08, schrieb Benjamin Thaut:
 I just wanted to get the contents of a smiple html page using
 std.net.curl (on Windows)

 So I did (exactly like in the library documentation example)

 string contents = get("dlang.org");

 But this won't even compile, not with dmd 2.062 and not with 2.063

 main.d(8): Error: cannot implicitly convert expression (get("dlang.org",
 AutoProtocol())) of type char[] to string
 C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\range.d(611):
 Error: static assert  "Cannot put a const(dchar)
 into a Appender!(char[])"
 C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\format.d(2160):
 instantiated from here: put!(Appender!(char[]), const(dchar))
 C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\format.d(2207):
 instantiated from here: formatChar!(Appender!(char[]))
 C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\typecons.d(581):
 instantiated from here: formatElement!(Appender!(string), char[], char)
 C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\net\curl.d(1873):
         ... (4 instantiations, -v to show) ...
 C:\digital-mars\dmd2-63\windows\bin\..\..\src\phobos\std\net\curl.d(374):
 instantiated from here: get!(FTP, char)
 main.d(8):
 instantiated from here: get!(AutoProtocol, char)


 Are the exampels not tested? What is wrong here?

 Kind Regards
 Benjamin Thaut
Nevermind, I found the problem, all the error message noise made me miss it.
Jun 23 2013