Talk about anything related to the rust programming langauge
/frg/ - Friendly Rust General
Other urls found in this thread:
internals.rust-lang.org
internals.rust-lang.org
github.com
internals.rust-lang.org
internals.rust-lang.org
github.com
github.com
doc.rust-lang.org
github.com
github.com
hackernoon.com
docs.fedoraproject.org
doc.rust-lang.org
doc.rust-lang.org
twitter.com
Fields in traits WHEN?
If I'm already proficient in C++, is it worth trying to learn Rust?
what are fields in traits?
I would suggest to learn the basics and not really use it for anything too big yet.
The compiler still needs a lot of refinements when it comes to compile time, efficient machine code generation, and a stable ABI that doesn't change every major release
struct members
Being able to access struct members in interfaces. Pretty basic huh
>efficient machine code generation
LLVM is rust's backend, so a lot of work has aready been done. Plenty of libraries take advantage of LLVM's optimizations to create zero cost abstractions.
>a stable ABI
You don't need it.
Also extern "C". The only other useful thing for a stable ABI is dynamic linking, which is useless anyways. Any library compiled as a dynamic linked binary is 100x larger than if you staticly linked it when needed. There are two uses for dynamic linking: Windows-style system calls, where you hide the interupt numbers, and plugins. Good software in rust exposes a scripting interface for plugins, rather than just mapping the plugin into your memory space and creating security issues forever.
Yes. You'll never want to touch C++ again.
Do I still need to be transsexual to use this language, or has the situation improved?
what situation?
You don't have to be transsexual, but you do at least have to be on HRT. It's all about making you good enough at programming to be able to understand rust.
Forcing gender neutral documentation.
Not compiling if you use toxic masculinity language.
etc.
cringe
>Not compiling if you use toxic masculinity language.
kek
fuck off
What niche does Rust fill other than Mozilla trying to create a Go for themselves?
you're mentally ill anyway so why does it matter
Why do you make so harsh assumptions on me? :/
the niche is for a guaranteed memory safety systems programming language
it has very little in common with go and they're not competing languages
Considering the only company that has picked up Rust seriously is Mozilla. There has to be some marketing or branding considerations here, which is the reason for Go's survival.
that's a whole lot of links for an irrelevant event that happened 3 years ago
I want to have an collection of vectors to arbitrary types - simple right? Just use Box
HOWEVER
the catch is that for performance reasons I want these vectors to hold those objects in memory contiguously i.e. not spread out at random memory locations.
Basically, the vectors themselves would be contiguous memory but I don't necessarily care about the container holding the vectors.
I've tried using a HashMap for the container, but Any could literally be anything and I need vectors.
...
It is literally impossible since the size of each element varies arbitrarily.
at least two minor game studios have sworn off c++ in favour of rust for future projects and a bunch of other companies have started using rust in some high publicity cases - npm being the most famous probably, I'm not sure what you mean by 'seriously' though, it's not like legacy code just disappears when companies decide to switch language nor will companies completely stop using c++
even less interesting than language comparisons are comparisons between how well rust and go are being adopted, go fits a much wider niche while being an incredibly simple language to pick up and it happened to hit market first by over a year, and before hitting market it had far less breaking changes during its 0.x phase than rust did, of course it's more popular as it's entirely an apples to oranges comparison
I am sick of Haskell's compilation speed and mediocre tooling. Is Rust better? Can you do FP?
Rust takes great inspiration from haskell and ocaml, but it is imperative through and through. Also I would say compilation speed and tooling are some of Rust’s weaker points funnily enough.
coming from haskell you might miss hkt but rust should be getting hkt-lite eventually in the form of generic associated types, seems to me that rust seems to be the stepping stone towards haskell though and not the other way around
compiling in rust takes longer than equivalent c++ too but it's not that much slower than if you're using modern safe c++, things got a lot better with incremental compilation
it's a niche for a systems language that doesn't require 20 years of experience to write relatively secure code
>muh feelings
grow up you manchild
Why are futures such a fucking mess and what are they doing to improve it?
Idk anything aboht futures. Is it paralell or just asynchronous?
I figuratively cannot wait. Macros will have to do for now, although I’m waiting for procedural macros just as badly.
>Also I would say compilation speed and tooling are some of Rust’s weaker points funnily enough.
Is Cargo really worse than the combination of Cabal and Stack?
NPM only started using Rust cos one of their maintainers is sleeping with a Rust dev.
This though. Not that I care if NPM uses Rust or not.
>at least two minor game studios have sworn off c++ in favour of rust for future projects
That isn't much of an accomplishment.
>a bunch of other companies have started using rust in some high publicity cases
Plenty of companies demo new languages. That's the reason that Hasklel has this long list of companies using it but their tech stack hasn't really changed from the tried and tested languages.
Didn't the inventor of the language start working on Swift? When even the inventor quits then maybe this isn't a bandwagon to be on too much longer.
I think they removed the problem from the book because of the controversy surrounding the pronouns. What a "nice" community.
Rust is a cult, you know it's true.
Apple is a cult, everyone knows it's true.
Man I love Rust.
t. Faggot
Swift isn't even portable.
LOL, this faggot. it uses LLVM, it can compile to everything.
It also runs on Linux, so... you argument is INVALID.
Hmm. Nice performance though. Did SIMD support land yet?
>writing like a FAGGOT
>REDDIT spacing
go back
Um, sweety, swift can't even compete. Try again later.
official support is nightly-only experimental
doc.rust-lang.org
there are some 3rd party as well
github.com
github.com
have not checked if rustc lets llvm do vector optimization on it's own but would bet it does
What would be a rust-like language but without the SJW shit?
Can't avoid SJWs in 2018. Prove me wrong.
isn't that just inheritance at this point
If you just use assembly you can avoid them.
Also, the C++ community isn't filled with SJW, there is no such thing as a COC.
If Rust/Mozilla trigger you so much, then make a fork without CoC and other "SJW shit". Code in itself is apolitical. Problem solved.
>muh CoC
>demanding basic human decency is SJW
>there is no such thing as a COC.
This is because C++ is not from this decade, all of its governing takes place behind the closed doors.
>CoC is bad
No it isn't. Jow Forums and Google has it and yet you use their services too.
Nothing wrong with inheritance.
hackernoon.com
>zero cost
>everything's 50% slower
Provide benchmarks and code or fuck off.
I don't use google you dummy.
>human decency
Something like the fedora CoC would be better imo.
docs.fedoraproject.org
How do you post here? Did you actually buy Jow Forums pass? lol
I use Jow Forums, but haven't find any CoC related page. I think the only CoC is don't post any illegal shiet and follow the boards rules.
>CoC
glorified "rules"
very well. I wrote an equivalent match statement to a switch in c so I could see
how they worked by dissasembling. Then I noticed that the rust one ran much
slower, and I figured it was an overhead that wouldn't scale if iterated to
repeat the test many times, but it did. i wouldn't mind seeing better profiling
to justify the difference or a more interesting program, but IMO most benchmarks
shown for rust that are close to C are probably using a subset of the language
that's equivalent to C and it would be a minefield if performance was your first
or second goal.
fn m(a: i32) -> i32{let r: i32 = match a{22=>123123,100=>324,_ => 32423,};return r;}
fn main(){
let mut i: i32 = 8800000;
while i > 0
{
i-=1;
m(34);}}
time rustc rtest.rs
real 0m0.243s
user 0m0.199s
sys 0m0.039s
time ./rtest
real 0m0.029s
user 0m0.027s
sys 0m0.002s
int m(int i) {switch(i){case 22:return 123123;case 100: return 324;default:return 32423;}}
int main(int argc, char **argv){
int x = 8800000;
while(x--)
{
m(x);}}
time gcc ctest.c
real 0m0.028s
user 0m0.018s
sys 0m0.010s
time ./a.out
real 0m0.021s
user 0m0.019s
sys 0m0.001s
Hey, I just care about the sjws cuz maybe someday I could program something considered "hateful" or some shit, and knowing the SJWs, they would target the rust devs with harassment.
correction: that's supposed to be m(i); on the last rine of the rust one. correct time is below
time ./rtest
real 0m0.032s
user 0m0.029s
sys 0m0.002s
Those don't even do the same thing. Plus your Rust code is utter shit. Also,
>that formatting
SIMD was stabilized for x86 and x86-64 in 1.27, but in std::arch, not in std::simd: doc.rust-lang.org
Has the same semantics as C++ intrinsics: doc.rust-lang.org
they do exactly the same thing wherever permitted by the language. if you have a specific example where they could be made more similar, please share.
>utter shit
yes i'm just testing one thing as the first bit of rust code I've written.
also disliking my formating isn't a valid criticism but thanks anyway asshole. It seems like rust users are 90% of the time busy with defending rust, sounds very productive
[user0@user0-pc rs]$ time target/release/rs
real 0m0.001s
user 0m0.001s
sys 0m0.000s
[user0@user0-pc rs]$ time ./a.out
real 0m0.001s
user 0m0.000s
sys 0m0.001s
[user0@user0-pc rs]$
Rust is not C. Using C idioms in Rust is often suboptimal and vice-versa. Plus m(34) and m(i) are PRETTY FUCKING DIFFERENT, GOOK FUCKWIT.
see >gook
what
>rigged benchmark
C tards are getting very nervous
...
Dumb. Please refrain from topics you don't know about.
...
i'm not sure what the context is for those.
...
care to explain
release flags. You are pretty fucking retarded if you think any of these calculations happen in runtime in modern compilers regardless of the languguage. Are you a beginner at programming? You sure have a lot of hot opinions. You should be glad this is an user image board.
> benchmarking debug builds instead of release builds
> not using the computed value, so the function will be optimized out in release mode
learn how to properly benchmark, please.
Are you running this on a pentium 4 or what? How the hell did you manage to get a 200 ms runtime? Even on my shitty thinkpad in debug mode I get 50ms max:
time ./rtest-debug
real 0m0,055s
user 0m0,048s
sys 0m0,004s
time ./rtest-release
real 0m0,005s
user 0m0,000s
sys 0m0,008s
No.
Doesn't make sense because LLVM compiles it down to a constant.
Sure faggot
comparing without optimization is not serious, the build time is llvm vs gcc comparison
clang with -O1 (and -C opt-level=1 for rust) emit the same code
(eliminating the constant call optimization, otherwise compilers would eliminate the function call entirely, see )
gcc and clang emit nearly the same code
clang++-6.0 and rust
cmp edi, 100
mov eax, 324
mov ecx, 32423
cmove ecx, eax
cmp edi, 22
mov eax, 123123
cmovne eax, ecx
ret
gcc
mov eax, 123123
cmp edi, 22
je .L1
cmp edi, 100
mov eax, 324
mov edx, 32423
cmovne eax, edx
.L1:
ret
clang thinks it's better to do it branchless, wonder what's better
Nice
that really defeats the purpose. in the real world you use the o flags but you also don't know the value you are switching by at compile time, so it does actually 'do the calcuations in runtime'.
also the 200 ms one was obviously compile time which is 10 times slower than gcc, i don't like that very much.
>o
>flag
Just stop, my dude. It's okay if you don't like Rust but you shouldn't waste time instead of learning programming.
no i'm enjoying the level of discourse in this thread. also i have no idea what you're talking about, O(x) is the optimization flag in gcc.
>he looked up the difference between o and O
kek next thing you should learn is the difference between a flag and an argument
see now the question is, can rust programmers rise above the bottom 4 levels? They seem to spend 90% of the time in the bottom 3.
>Imagine being this cucked
i normally call it a switch, this thread was saying flag, so why would I confound others by using other terminology? also try to stay on topic.
On topic of what, your compile time function call that can totally be eliminated? LMAO kiddo
Doesn't the rust CoC(k) just apply to their forums and irc?
Rustfag myself, I haven't had the luxury to bash a stupid SJW in GH because they don't flock to my projects for some reason.
God I wish a comment like this were made in my repo.
Yeah it's stupid, but ultimately I don't give a shit what pronouns my documentation uses, and Rust is a great language.
> i favor eliminating it to dismiss the fact that rust's match is inherently slower and not equivalent to switch/case
>rust thread
>ctrl+f "coc"
>10 matches
>ctrl+f "sjw"
>9 matches
never change, Jow Forums
>rust's match is inherently slower and not equivalent to switch/case
Prove it or bullshit
>protip, it is
When will Rust get a usable standardization?