Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Rust the C replacement

Name: Anonymous 2017-02-07 13:20

http://esr.ibiblio.org/?p=7294&cpage=1
In practice, I found Rust painful to the point of unusability. The learning curve was far worse than I expected; it took me those four days of struggling with inadequate documentation to write 67 lines of wrapper code for the server.

Even things that should be dirt-simple, like string concatenation, are unreasonably difficult. The language demands a huge amount of fussy, obscure ritual before you can get anything done.

The contrast with Go is extreme. By four days in of exploring Go I had mastered most of the language, had a working program and tests, and was adding features to taste.

Name: Anonymous 2017-02-12 5:51

write my anus

Name: Anonymous 2017-02-12 14:00

:stopmusic:

Name: Anonymous 2017-02-12 17:13

>>40
It doesn't fall back to unbuffered printing if malloc falls however.
Good luck trying to echo an 1GB string this way.

Name: Anonymous 2017-02-12 17:17

CHECK'EM MOTHERFUCKERS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! SIEG HEIL!!!!!!

Name: Steve 2017-02-12 17:26

>>44
nooooooooooooooo!

Name: Anonymous 2017-02-12 20:53

>>31

It's because the plan9 people wanted it only to write once, because when doing lots of echo's over network filesystems, that would get very slow quickly.

Name: Cudder !cXCudderUE 2017-02-14 2:53

>>46
Apparently they've never heard of caching?

Name: Anonymous 2017-02-14 7:37

>>47
Caching is bloat

Name: Anonymous 2017-02-14 8:45

>>48
Nope. Caching is the #1 performance enhancing algorithm.
Your CPU has 3 levels of caches. OS has disk read/write caches, your IO library has cache buffers, your browser stores render pages in cache, Cache servers store static copies of websites to get the downloads faster. Caching is everywhere, even your desk is a cache of all important items in the room.

Name: Anonymous 2017-02-14 12:56

>>49
How bloated! All that redundant data taking up space!

Name: Anonymous 2017-02-14 15:27

>>49
But write(2) doesn't have cache buffers, right? Wouldn't you have to split the data into buffers small enough to fit into the fast CPU cache to take advantage of it?

Name: Anonymous 2017-02-14 16:14

Programming for me is like a religion. And Rust is the shit.

Name: Anonymous 2017-02-14 16:21

>>51
write doesn't need cache buffers, its for writing big files down.
fwrite is only faster when you have random small chunks of data getting written to disk.
fwrite
A.fills buffer with data.
B.writes the buffer to stream when if full (flush)
(https://www.gnu.org/software/libc/manual/html_node/Controlling-Buffering.html can be disabled)
write
A.Just sends the data to IO system of kernel

Name: Anonymous 2017-02-14 17:56

>>38,46
Pipes on plan9 preserve write boundaries, so they may have written it like that to ensure that every echo is a "packet". Not sure who would ever want to rely on the write semantics of echo(1) though, not that this behavior is documented to begin with... http://man.cat-v.org/plan_9/1/echo

>>47
How safely CAN you cache writes over a network though? Blocking reads are often used for synchronization, so a program can cease to be correct if a write to it is only delivered when the network stack feels like it.

Name: Steve 2017-02-14 18:03

I claim these dubs in the name of the LORD

"Come to me, all you who are weary and burdened, and I will give you rest."

Matthew 11:28

Name: Anonymous 2017-02-15 0:37

ori_b 723 days ago [-]
Note that the plan9 version does some extra work so that it can send the entire buffer in one write() operation. This is because Plan 9 guarantees that messages smaller than the size of a pipe buffer are sent as an atomic write, given a sufficiently large recieve buffer on the other end.
This simplifies quite a bit of code that reads and writes commands into ctl files.

lallysingh 723 days ago [-]
Why copy it all instead of writev()?

ori_b 723 days ago [-]
http://plan9.bell-labs.com/sources/plan9/sys/src/libc/9sys/writev.c
In other words, writev on plan9 isn't a system call -- it does the same copying that echo.c does. Also, echo.c probably predates writev.c.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List