[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

Rust debate thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 38
Thread images: 2

File: rust.png (4KB, 225x225px) Image search: [Google]
rust.png
4KB, 225x225px
So a while back I decided the C++ project I'm working on should really be using fixed size integers. I settled for changing
>typedef unsigned uint
to
>typedef uint_fast32_t uint
I can't remember if that type actually guarantees a size of 32, but it didn't work with GCC regardless, uint was already typedefed and I couldn't find any way to change it.

What most people really want is i32 and u32, and this minor design flaw (imho) was enough to give me the itch we all get occasionally to find a replacement for C++.

So I'm reading through the Rust documentation and decided I'd enjoy posting my comments here and seeing what people have to say, since I don't have any programming friends.

> Cargo qua build system
THANK. FUCKING. GOD. Writing page long build scripts really is a waste of time.

> Cargo qua directory convention
Also seems pretty nifty, but I'm not completely sold yet.

> static linking by default
You can fuck right off with this one. That's some stupid shit right there.

> Bounds checking
At least in the basic documentation, it's not nearly clear enough how much of this is kept in the release executable, or how to control whether it's on or off. I like the idea, but defer judgement until I understand exactly what it's doing.

> scalar typenames
Once again: THANK.FUCKING.GOD.

> declaration syntax
Seems verbose. I prefer mutable default to constant default.

> Use of semicolon for expression vs. statement
I like it. Seems a tad clearer.

> Optional return keyword
Very obnoxious and hurts readability.

> Parens not needed around if condition
Awesome, less pointless typing.

> Macros end with !
This might be my favorite thing about the whole language. Macros are awesome for writing concise, DRY, code, but not marking them explicitly make creating refactoring tools harder, and hurts readability.

> == for equality comparison
WHY??? FUCKING WHY??? Am I the only one who still constantly writes "if x = y" on accident even after years of programming?
>>
Shut the fuck up with your meme language for noobs.
>>
>>61421592
Shitty argument. C++ has tons of cruft and flaws, and no one has made a better language yet.

If you aren't interested in that happening, then you're a noob who has never tried writing a complex enough piece of software to want compile time reflection or a variadic function.
>>
It appears this board no longer has even remotely competent programmers, just faggot children whining about their gaming keyboards. What a shame.
>>
>>61421834
>claims to be a competent programmer
>rants about semicolons, return syntax, and other kinds of bikeshedding fodder
awful b8 my dude
>>
>>61421545
>>typedef unsigned uint
>to
>>typedef uint_fast32_t uint
Use nim
https://glot.io/snippets/ertc8vw9dh
>>
>>61421883
If language syntax isn't interesting to you, and apparently it isn't interesting to anyone here, then this is going to be a boring thread.

I haven't even gotten to the meatier part of language, so yeah, these might not be the best part of the language to talk about.

Unfortunately, it looks like people here are a lot more interested in delusionally satisfying their superiority complexes than talking about code. So I'm out. Stupid idea to think intelligent people might be lurking on 4chan anyways.
>>
>>61421545
I think Rust changes too much. A cleaner C++ replacement would be nice, but it'd still fundamentally be C++.
>>
>>61421995
>intelligent people
>4chan
cmon m80.

Either way, I have never wrote super duper hurr durr programs on C++ a side from some small modules that integrate with python and JS for personal use.

I find that solving problems is easier if I spend more time on the actual problem than type checking & compiling, but that's mainly because I'm a college student and my deadlines are sometimes as small as 3 days.

Moving to the topic of syntax, I don't dislike C++/C syntax I actually find it really comfy mainly because most languages I've used have similar syntax (except for Haskell). I'm starting with Rust and syntax is a bit weird but again not far from C.

For what I've learned Rust is more about code safety and less bugs, in which immutable default makes sense, I'm liking it since it seems to perform really well on most benchmarks and a claimed 80% bug reduction looks remarkable.
>>
>>61422209
Yeah, that sums up how I feel about it pretty well.
>>
>>61422398
Dlang does a lot of nice things (template syntax and UFCS) but shits the bed with excessive GC reliance and other weird design choices (e.g. enums)

Rust enums are awesome, on the other hand.
>>
>>61421696
>and no one has made a better language yet.
define better

it takes a lot of work to make C++ fast, not to speak of initial investment in learning
>>
>>61421545
>> static linking by default
>You can fuck right off with this one. That's some stupid shit right there.


yeah let's make programs that download redistr bloatcrap for a millionth time to the end user to save a few MB from the executable that's a great idea.
>>
>>61422221
is this a reference to
int 0x80
?
>>
delete this;
>>
Thank you. I don't trust languages with automatic types. Is this number an int, unsigned int, or maybe long? Oh. It's float.
>>
>>61424291
What are you talking about?
>>
Daily reminder all Rust threads on /g/ are made by shills paid by mozilla to get their language some real world usage. Ignore them at all costs.
>>
>>61425277

this.
>>
>>61421545
bait with some effort.
bravo
>>
>>61422221
Rust is meh at best.
default immutability is nice.

but that entire borrow system can go and fuck itself.
that thing is more a burden than an aid because you constantly need to worry about who owns it at what time.

Also, shit like `into_iter` are complete bullshit and a lame excuse for not having arrays and vectors be iterable in the first place.

and everyone just works around it by .copy ' ing the fuck out of everything to not have to bother with ownership
>>
Good C/C++ programmers already write safe code.
>>
>>61421545
>> Optional return keyword
>Very obnoxious and hurts readability.
It's an expression language. You only ever write "return" when it's an early return, which you avoid most of the time anyways. I'll bet you that 75%-80% of the for loops you'd write in Java or C++ (before <algorithm> became a thing) can be rephrased as 1-3 iterator methods.

>> == for equality comparison
>WHY??? FUCKING WHY??? Am I the only one who still constantly writes "if x = y" on accident even after years of programming?
Yes you are.

I am enjoying Rust a lot and I agree with a lot of your points. However one thing I'm afraid of is distrbuting Rust to other people. Rust projects commonly pull in TONS of dependencies, like 10-15 sub-dependencies if you include just a few simple dependencies. It doesn't feel as lightweight to distribute Rust sources as it is to say, send somebody a Makefile and a "src" folder.


>>61427183
>that thing is more a burden than an aid
I might agree. I wish I could have a lot of the upsides of Rust without having to opt into the borrow system, but I understand that it plays an important role.

>Also, shit like `into_iter` are complete bullshit and a lame excuse for not having arrays and vectors be iterable in the first place.
Those create iterators. Name me ONE language where iterators aren't separate from the thing being iterated on.

>everyone just works around it by .copy ' ing the fuck out of everything
Only clueless Rust programmers would do that. Although one of the bad things about Rust is that it requires a paradigm shift but attracts idiots who can't be bothered to learn anything beyond their Java and minor C++ knowledge.
>>
>>61427183
You still have to worry about who owns what in C and C++, but the consequences are memory leaks, subtle bugs, and/or undocumented assumptions, all of which are less important during early prototyping, rather than compile-time errors that are useful during long-term maintenance. Still annoying to deal with when you know the program is currently single-threaded with no re-entrant functions, and the whole thing terminates long before it would need to free memory at all, though.
You CAN iterate over a Vec, but it consumes it in the process. You can't iterate directly over an array, but you can just write for x in &arr and it'll work again. Then there's always .iter() and .iter_mut().
Finally, it's .clone, not .copy.
>>
>>61421545
You forgot
>Pattern matching
Literally godsend.

However I believe Rust's Module system is a bit weird. D's module system is simpler where every file is a package. Nice and simple.

The only reason I don't use Rust is because it's sorta difficult to get stuff done, like C itself.
>>
>>61421941
I am reading through the Nim book as of now, and I am fairly confused with format proc actually.

How do you write stuff like this?
writeln("An int value: %i, and a string: %s", intval, strval);
>>
>>61421941
That seems like a misfeature, why would I want to redefine an existing type half way into my code? How does this affect multiple files/modules that all redefine a type in different ways?
>>
>>61428471
Wrong
>>
>>61429513
If they don't write safe code, they aren't good C/C++ programmers.
>>
>>61429574
No one is a good C/C++ programmer then
>>
>>61429590
Well you certainly aren't
>>
>>61429607
Neither are you, more certainly
>>
>>61429615
I've never written C/C++ with bugs in it, you on the other hand,
>>
>>61429628
Hello world programs hardly contain bugs
>>
>>61429633

savage
>>
>>61429633
void main()
>>
File: 1465278981533.png (237KB, 399x305px) Image search: [Google]
1465278981533.png
237KB, 399x305px
Great, the Rust autist is going on again on way his over dependent and obtuse language has to replace C/C++ while samefagging. Great thread as always.
>>
>>61429721
What is an over dependent language?
Thread posts: 38
Thread images: 2


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.