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-07 17:02

Doesn't Go not have generics?

Name: Anonymous 2017-02-07 18:51

Pike pls

Name: Anonymous 2017-02-07 19:51

The language learning curve is irrelevant in practice as it gets highly amortized the more you use the language. In fact, the amortized cost may even turn negative if the language complexity simplifies using libraries, testing, optimization, improves correctness etc.

Name: Anonymous 2017-02-07 20:23

>>2
`>I want to call a function but I don't know which one I want to call

Generics were a mistake.

Name: Anonymous 2017-02-07 20:44

>>5
Dude, even fucking BASIC had generics.

Name: Anonymous 2017-02-07 21:09

>>5
You ever programming was a mistake.

Name: Anonymous 2017-02-07 21:27

Https://appliedgo.net/generics/

Just reading about the "alternatives" to generics made by gotards makes me laugh. There's not a single viable alternative there but they actually recommend you to simulate generics through hand-rolled shitty code generators. Fucking numbskulls. Just the fact they think there can be any debate about whether generics are necessary shows Go is a language by a retard and for retards.

Name: Anonymous 2017-02-07 21:35

I think Golang should be renamed into Nolang, short for "No Generics Language".

Name: Anonymous 2017-02-08 2:51

>>8
Go is weird. It really seems like its language authors set out to ignore the last 30 years of language research, and succeeded. The first thing I did in a non-trivial program was take a parallel work queue function I'd written and abstract it to handle any type.

I start with this:

WorkInParallel(items []Foo, workOnItem func(f Foo) {
// work on f
})


But I need to be able to call it with []Bar too. Well I can't do the obvious and write something like WorkInParallel<T>(items []T, workOnItem func(t T)) because no generics. Fine, I'll just use the unspecified type and force the callers to cast.

var bs []Bar = ...

WorkInParallel(bs, func(i interface{}) {
b, _ = i.(Bar)
// do the actual work
})


That looks like shit, but at least it works. Oh wait, no it doesn't:

cannot use bs (type []Bar) as type []interface {} in argument to WorkInParallel

Well I'll just cast bs to a slice of interf--

invalid type assertion: bs.([]<inter>) (non-interface type []Bar on left)

OK FINE

var bs []Bar = ...

is := make([]interface{}, len(bs))
for i, b := range bs {
is[i] = b
}

WorkInParallel(is, func(i interface{}) {
b, _ := i.(Bar)
// do the actual work
})


What the fuck??

I'm not saying I completely dislike Go. It's reasonably performant, easy to write and doesn't have too much baggage. It feels more structural than object-oriented, which is nice. I even think that design decisions based on subjective factors are defensible.

But what I can't stand is Go zealots pretending there's some grand strategy behind the language's quirks other than "Ken/Rob didn't like that feature". There is no method to this madness.

Name: Donald Trump 2017-02-08 3:27

Check 'Em.

Name: Anonymous 2017-02-08 4:06

>>11
Awesome dubs, Mr. President.

Name: Anonymous 2017-02-08 6:09

Daily reminder that even C has generics in form of _Generic macro which selects overload of function/macro based on compile-time type.

Name: Anonymous 2017-02-08 21:28

>>13
Or you could just use tagged unions like a normal person, rather than reinventing the wheel.

Name: Anonymous 2017-02-08 21:50

C replacement? It's been with us awhile now, and it's called C++.

Name: Anonymous 2017-02-08 23:40

>>15
sage

Name: Anonymous 2017-02-09 7:42

>>16
yes this is a sage post very wise

Name: Anonymous 2017-02-09 8:05

>>15
IHBT

Name: Rustafarians Unite! 2017-02-09 10:02

Rustafarians Unite!

Name: Anonymous 2017-02-09 12:08

Name: Anonymous 2017-02-10 6:17

Found something else. Let's take a look at cat(1)

Here's a big list, except for sbase's and acu's: https://gist.github.com/pete/665971
The Suckless version from sbase: http://git.suckless.org/sbase/tree/cat.c

Now, GNU and BSD's version of cat are bloated, sure. But take a look at cat re-implemented in Rust.

https://github.com/uutils/coreutils/blob/master/src/cat/cat.rs

Look at home many people are contributing to the project. They're already campaigning in typical marxist fashion for distros to use it instead of GNU Core Utils, claiming it's more secure and faster and that it's the future.

Name: Anonymous 2017-02-10 8:00

>>21
Its faster because putc/getc are slow.
Try to read()/write() with custom buffer

Name: Anonymous 2017-02-10 9:46

>>22
but many C cat implementations don't use putc/getc. see plan9

Name: Cudder !cXCudderUE 2017-02-10 11:37

>>21
Look at the binary sizes for even more sense of bloat.

>>22
It also takes over the cache with its elephantine size, making everything else on the system slower. These benchmarks are stupid and the reason for things like 4-kilobyte memcpy() implementations.

>>23
Most don't. Suckless is one of the exceptions.

Name: Cudder !cXCudderUE 2017-02-10 12:10

I'm gay!

Name: Anonymous 2017-02-10 14:24

>>25
fuck off fake cudder

Name: Anonymous 2017-02-10 14:53

>>21
Incredible. Rust has all the inefficiencies of a scripting language, except you actually have to type them out yourself instead of the runtime inserting them automatically.

Name: Anonymous 2017-02-10 22:45

>>21
This smells like a dead striped Polecat /kebabs/, not like a cat.

I also remember that the echo implementation of GNU as well as the original echo for unix both could handle out of memory situations unlike the plan9 echo that needed to allocate a whole buffer and crashed otherwise.

Name: Anonymous 2017-02-10 23:50

>>28
the original echo for unix both could handle out of memory situations

What's the point of handling OOM if your program's only job is to send the input to stdout? What is it going to do, keep running? Might as well crash.

Of course if plan9 is doing something insane like buffering the entire input, then yeah they're idiots.

Name: Anonymous 2017-02-11 0:43

>>29
Why should it crash when it doesn't have to? Sure, running unbuffered will be slow as balls, but for forensic sys admin slow is better than nothing.

Name: Cudder !cXCudderUE 2017-02-11 17:09

>>28-30
The real question is why the fuck does echo even need to dynamically allocate memory? Its only job is to print argv, which has already been allocated by the kernel. If there's no memory for argv there's no chance the process can even start.

Name: b00mheadsh0t@hotmail.com 2017-02-11 17:17

>>31
cudder man, where can i find some of your source code repos?

Name: Anonymous 2017-02-11 17:39

>>31
what about echoing a stream though

u need to allocate a buffer to hold each chunk

or you can do it 1 byte at a time but that's not efficient

Name: Anonymous 2017-02-11 20:11

>>32
``open source" is a codeword for bloat

Name: Anonymous 2017-02-11 21:24

C CONSIDERD HARMFULL AND RUST TOO!!! ALL COMPUTER VIRUS ARE CREATED WITH C SCIENCE COMPUTERS RUST MAKES MORE VIRUS!! IM COMPUTER SCIENCE HASKELL USE HASKELL PROTECT

Name: Anonymous 2017-02-11 23:46

>>35
The Hasklel runtime is written in C. Use a self-hosting lambda calculus interpreter instead.

Name: Cudder !cXCudderUE 2017-02-12 0:57

>>33
What do you mean "echoing a stream" --- the echo command echoes argv and nothing else. (Unless GNU decided their bloatutils version would...?)

Name: Anonymous 2017-02-12 2:41

Name: Anonymous 2017-02-12 4:02

>>38
probably to make the program 'faster' by doing only one io syscall. (it's retarded and they shouldn't)

Name: Anonymous 2017-02-12 4:21

>>38
Because write is orders of a magnitude slower, especially when writing to regular old disk drives.

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