22 comments

[ 3.3 ms ] story [ 58.0 ms ] thread
If this is wget, my bicycle is a car.

This isn't "Wget in 50 lines of C code", just `wget --help` page is 192 lines.

It’s just the title that’s a bit simplified. First paragraph already says:

“This tutorial is meant as an introduction to libdill socket library. We are going to develop a simple version of wget utility, that can be used to download webpages from the net.”

a bit simplified? title would be considered clickbait if it were a webpage.
Editorialized clickbait from the HN user, that is. The original is just fine.
Apparently the author and HN user are the same person.
Oh, wow! Indeed. That's disappointing.
+k lines of libdill.c
… and don't forget libc!
You can't conflate using a special-purpose library with using a fundamental dependency like libc.

It's like claiming you "rewrote Quake in 2 lines" then posting a .bat file with the contents "echo Starting quake lol...\r\nquake.exe"

... and don't forget the OS. It's a deep rabbit hole.
It's all abstractions and sometimes concretions. Then there's leaky abstractions where you need to know details of the implementation in order to use it.
Actually one could go without that library and code would not be that much bigger. To me it seems it provides an easier way to open secure pages through TLS, but if all one needs is sockets communicating each other, then the usual network libraries are more than enough. Ages ago I've written C network code under Linux that compiled and run under Windows just by changing a couple lines. Not sure if that would be doable today though: at that time Microsoft was forced to include a POSIX compatibility layer, and Winsock itself was not that far from the classic UNIX implementation.
libdill looks interesting, but I'm a bit surprised by the lack of prefix in the functions, types, etc. C does not have namespaces, but open source libraries usually use short prefixes for readability. What do you think ?
It is disingenuous to plug your own library with a click bait title and no indication that you are the author.
Those titles suck. Next week I post my 'Wget in 2 lines of Bash code':

  #!/usr/bin/env bash
  curl "${@:2}"
I mean, if you use a lib it is no wonder you have a low line count and the result is in fact as much Wget as curl is wget (probably even less).

How about 'Tutorial: HTTP Client in C with libdill'?

OK, changed. Thanks!
It would be interesting to see a performance comparison between libdill and goroutine for concurrent network requests.
What is the difference with libcurl ?
libdill is about concurrency made easy (according to the home page). But this tutorial has no concurrency as far as I can see after a quick read. That's a bit weird way introducing a library.