CVu, Code Critique, and D

Russel Winder russel at winder.org.uk
Tue Jun 19 14:42:20 UTC 2018


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.

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.

[…]
> 
> There is vibe.web.rest which covers 90% of everything one might 
> need for their back-end application. There's practically no 
> reason to bother with bodyReaders/Writers.

So the person did not properly RTFM. Not surprising, the person did say they
were a beginner.

> > 
[…]
> 
> 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

-- 
Russel.
===========================================
Dr Russel Winder      t: +44 20 7585 2200
41 Buckmaster Road    m: +44 7770 465 077
London SW11 1EN, UK   w: www.russel.org.uk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20180619/cae1d15a/attachment-0001.sig>


More information about the Digitalmars-d mailing list