CVu, Code Critique, and D
Anton Fediushin
fediushin.anton at yandex.com
Tue Jun 19 19:22:31 UTC 2018
On Tuesday, 19 June 2018 at 14:42:20 UTC, Russel Winder wrote:
> On Tue, 2018-06-19 at 13:43 +0000, Anton Fediushin via
> Digitalmars-d wrote:
>>
> […]
>> I'm not quite sure constructive critique is possible in this
>> case. It's just a bad piece of code poorly implementing
>> something that is a part of the vibe-core.
>
> Constructive criticism is always possible. The second sentence
> followed by a paragraph or two providing evidence as to why and
> what is better,would be ideal.
Thanks, maybe I'll try and write something as constructive as
possible.
>
> A hidden agenda here is to get C++ people to ignore all the C++
> offerings and use D/vibe.d instead. That a crap example has
> been posted should be ideal material to get stuck in to the
> technical marketing.
Using C++ sometimes can be a bad idea. Using C++ for web is
always a bad idea. Can't agree more, D is a great language by
itself and there are smart people working on it. The only thing
missing is somewhat good marketing for all of that.
>>
>> 1. It has something to do with lynx, curl works flawlessly
>> 2. Writing HTTP manually is somewhat painful. Request should
>> look
>> something like this:
>>
>> $ echo -ne "POST / HTTP/1.1\r\nHost:
>> localhost:8080\r\nContent-Length: 3\r\n\r\nHey" | nc localhost
>> 8080
>>
>> 3. There's `pipe` function in `vibe.core.stream` which does
>> exactly that. I haven't looked at its code but I'm pretty sure
>> it's far more efficient than byte-by-byte approach:
>>
>> ```
>> import vibe.d;
>>
>> void main() {
>> auto settings = new HTTPServerSettings;
>> settings.port = 8080;
>> listenHTTP(settings, (req, res) {
>> req.bodyReader.pipe(res.bodyWriter);
>> });
>> runApplication();
>> }
>> ```
>>
>
> This is clearly getting well stuck in to the task. Can I
> suggest finishing this off and sending it to scc at accu.org
I will try and do so. I can't see a reason to not give it a try.
I'd like more people to participate. Maybe then we'll see more D
in the Code Critique.
More information about the Digitalmars-d
mailing list