Home › Forums › Science & tech › Learn Rust. NOW.
- This topic has 175 replies, 1 voice, and was last updated 7 months, 2 weeks ago by
Anonymous.
-
AuthorPosts
-
-
October 3, 2021 at 7:22 pm #154331
-
October 3, 2021 at 7:23 pm #154332
Anonymous
Guestno tail call optimization, no good
I’ll stick with F#-
October 3, 2021 at 7:44 pm #154339
Anonymous
Guest>using the microshaft version instead of real ocaml
cyanide. now -
October 3, 2021 at 7:49 pm #154347
Anonymous
Guest>no tail call optimization, no good
cargo build –release
You’ll get your TCO. -
October 4, 2021 at 12:01 am #154375
Anonymous
Guest>im too stupid to make a loop
-
October 4, 2021 at 12:49 pm #154437
Anonymous
Guest>no tail call optimization,
So what does this cluster fuck do for recursive functions that are tail recursive, genuine question.-
October 4, 2021 at 1:01 pm #154444
Anonymous
Guestrust is imperative, get over it
do your CPS stuff in a proper FP language
-
-
-
October 3, 2021 at 7:24 pm #154333
Anonymous
GuestI don’t need something in the spirit of C. I already have C.
>C++ is a bloated piece of shit with garbage educational material.
>Rust tries to be a better C/C++ but manages worse performance and makes up for shitty programmers by bringing in its own GC and memory safety.-
October 3, 2021 at 7:40 pm #154336
Anonymous
Guest>its own GC
the last time rust had a gc you were still sucking your mom’s tits -
October 4, 2021 at 1:54 am #154377
Anonymous
Guest> Rust
> GC
Its amazing. The people that hate Rust the most somehow know the least about it. -
October 4, 2021 at 1:44 pm #154465
Anonymous
GuestBut I don’t WANT more python nodeJS abstraction shit. I want just a regular programming languages like C or C++ lmao.
I don’t want to keep going in reverse.
This
-
October 4, 2021 at 1:45 pm #154466
Anonymous
Guestfor the nth time RUST. DOES. NOT. HAVE. A GC
that’s why it’s very easy to call C, C++ or fortran from rust-
October 4, 2021 at 1:53 pm #154469
Anonymous
GuestBut what is my main argument? its that I don’t want more abstractions. I want to move towards C not away from it.
Operating systems are built in C. Every bit of microcode I’d imagine is too. Its the foundation and everything else is extra.
You could make an argument that its all linkers and compilers and language constructs. Why then is it that we end up with C components in languages like Rust and Python then? Interoperability? Bullshit. C is faster/is the core man.
The guy who built the LLVM that does the work for Rust works at Apple on Swift now. IMO he was what made Rust have anything tangible. Babbys first frameworks populating the crates package manager is no different than framework of the month syndrome in NPM/javascript.
Im good man. I want to be able to write and build artifacts that are blackbox and are as low level as possible now.
-
October 4, 2021 at 2:27 pm #154473
Anonymous
Guest>C components in Rust
the fuck are you talking about -
October 4, 2021 at 4:38 pm #154486
Anonymous
Guest>But what is my main argument? its that I don’t want more abstractions. I want to move towards C not away from it.
>Operating systems are built in C. Every bit of microcode I’d imagine is too. Its the foundation and everything else is extra.
The need for "more abstractions" is caused by C being shit. That entire "foundation" is broken. As C became more popular, everything became worse. Slower, buggier, less powerful, and more bloated.
-
-
-
October 4, 2021 at 1:49 pm #154468
Anonymous
Guestsane & same
-
-
-
October 3, 2021 at 7:24 pm #154334
Anonymous
GuestI have. Rust and C++ are my favorite languages. Rust for an investment in the future, C++ for now. Fuck scrotes
-
October 3, 2021 at 7:29 pm #154335
Anonymous
GuestI will stick with the first programming language i decided to learn recently thank you.
-
October 3, 2021 at 7:43 pm #154337
Anonymous
GuestI’ve been told I’m not welcome in the rust communities. I don’t have any problem with the language itself, seems decent enough, but I’m not going to invest lots of time into a programming ecosystem where I can’t interact with the community.
-
October 3, 2021 at 7:44 pm #154340
Anonymous
Guestmaybe next time don’t come in sperging about trans people
-
October 3, 2021 at 7:48 pm #154346
Anonymous
GuestI didn’t say anything about trans people. I called something scrotebrained, which supposedly is "ablerist" or some such bullshit. Anyways, I’ve seen such people before, pearl-clutching puritan burger-scrotebrains. You can be as snarky and mean spirited as you want as long as you do it passively-aggressively and along the lines of whatever arbitrary moral guidelines the community press-gang enforces at the moment. No thanks.
-
-
October 3, 2021 at 7:50 pm #154348
Anonymous
Guestreal men learn to program by themselves
-
October 3, 2021 at 7:52 pm #154350
Anonymous
GuestI guess you’re a bit fresh to this and I like your attitude in general, but the problem isn’t learning a language, that takes a couple of weeks. The problem comes when sometime down the line you will have to interact with the community in some way, if only to report a bugfix or something.
-
October 3, 2021 at 7:55 pm #154352
Anonymous
Guestnot new
just open a pull request and be professional
no need to mention the nwo plot to turn frogs gay and aggravate teenagers having mental problems because they didn’t have a father growing up-
October 3, 2021 at 7:57 pm #154354
Anonymous
GuestNo, I’ve already been told I’m not welcome in the rust community so how can there be any pull requests. No idea what’s going on with your strawman of gay frogs, but you do you.
-
October 3, 2021 at 8:01 pm #154359
Anonymous
Guesthow exactly did that happen
-
October 3, 2021 at 8:04 pm #154361
Anonymous
GuestAlready explained that.
-
-
October 3, 2021 at 8:37 pm #154363
Anonymous
GuestDid they really permanently ban your github profile from contributing because of you calling a thing scrotebrained?
-
October 3, 2021 at 11:53 pm #154374
Anonymous
GuestNo of course not. I’m quite able to "sneak" myself back into the community. But I’m not going to do that when I’ve been told I’m not welcome. It’s the principle of the thing.
-
-
-
-
October 4, 2021 at 2:01 am #154379
Anonymous
Guest>I guess you’re a bit fresh
>The problem comes when sometime down the line you will have to interact with the community in some way, if only to report a bugfix or something.
I’ve been programming in Rust for few years. I’ve contributed to open source projects, submitted issues, discussed Rust’s internals in their IRC, and nothing unpleasant happened. Not even /poo/tard trigger fuel like some random member having pronouns in their nick.What bad experiences did you exactly had with this community you are talking about?
-
October 4, 2021 at 2:21 am #154380
Anonymous
GuestWell, I’m not going to dox myself with specifics, but I had an experience in one of the official rust communities where I mentioned that something was scrotebrained. I was then jumped upon by a group of pearl-clutching mental baboons, who instead of just taking this statement at face value and substituting it in their fragile minds that this normal colloquialism means that I thought the issue in question was stupid, and not an attempted genocide on cripples, they proceeded to press-gang me about something called "ablerism" and referring me to their code of conduct.
Naturally, like any reasonable person, I told them that this whole reaction was freaking scrotebrained, which resulted in a ban.
-
October 4, 2021 at 4:30 am #154382
Anonymous
GuestI bet you also tell policemen they’re scrotebrained
-
October 4, 2021 at 5:59 am #154387
Anonymous
GuestIf they’re being scrotebrained, yes. But that’s not the point.
apparently "stupid" doesn’t cut it either, might as well say gtkrwn
No idea what that means.
-
October 4, 2021 at 6:10 am #154389
Anonymous
Guesta popular catchphrase about chemical genocide against a subpopulation and immediately starting a civil war woke af on ethic resentment
-
October 4, 2021 at 6:16 am #154392
Anonymous
GuestOh ok. Well, I’m really not into all the politics of things and I’m a pretty mellow guy. At least that’s what I think. But there is something very wrong with how social groups like that operate so it’s best to stay away. I was born in Soviet.
-
-
October 4, 2021 at 6:22 am #154394
Anonymous
GuestGRASS THE BIKES LACE WAR NOW
no, but I wrote the C++ version
-
October 4, 2021 at 6:24 am #154395
Anonymous
Guestnow write the C version so it can actually be used in the real world
-
October 4, 2021 at 6:50 am #154401
Anonymous
Guestcool, i learned lots from your blurry screenshot.
-
October 4, 2021 at 6:51 am #154403
Anonymous
Guestyou’re welcome, it’s propietary sofware now, scrote
-
-
-
-
October 4, 2021 at 5:29 pm #154493
Anonymous
GuestWhat kind if scrotebrained argument is this?
-
-
October 4, 2021 at 5:47 am #154385
Anonymous
Guestapparently "stupid" doesn’t cut it either, might as well say gtkrwn
-
-
-
-
-
October 4, 2021 at 4:03 pm #154483
Anonymous
Guest(((they))) want (((us))) to not use rust. That is the complete and utter truth. The superior straight man is being pushed awya from rust, which is proof that we should rebel and take over the trannies.
-
-
October 3, 2021 at 7:44 pm #154338
Anonymous
GuestLol no concurrency
-
October 3, 2021 at 7:46 pm #154342
Anonymous
GuestYou’re thinking of OCaml.
-
-
October 3, 2021 at 7:45 pm #154341
Anonymous
Guest>Learn Rust. NOW.
Already did. -
October 3, 2021 at 7:47 pm #154344
Anonymous
GuestSorry, but I’m not trans.
-
October 3, 2021 at 7:56 pm #154353
Anonymous
Guest-
October 3, 2021 at 7:57 pm #154355
Anonymous
Guestdo you scrotebrains have pattern matching yet
-
October 3, 2021 at 11:36 pm #154373
Anonymous
GuestJust a if-else with syntactic sugar
-
October 4, 2021 at 9:34 am #154408
Anonymous
GuestNot true by the way
-
October 4, 2021 at 9:41 am #154409
Anonymous
GuestDo
https://pastebin.com/wrPFP5fH
in Go or C-
October 4, 2021 at 12:02 pm #154427
Anonymous
Guestin Go this is just
if len(slice) == 0 {
fmt.Println("empty")
} else if len(slice) == 1 {
fmt.Println("one")
} else {
fmt.Println(slice[0], slice[len(slice)-1])
}if len(slice) > 0 {
if slice[len(slice)-1] == "1" {
fmt.Println("!!!")
} else if slice[len(slice)-1] == "z" {
fmt.Println(slice[:len(slice)-1])
} else if slice[0] == "a" {
fmt.Println(slice[1:])
} else {
fmt.Println(slice)
}if len(slice) > 1 {
fmt.Println(slice[len(slice)-2])
}//no tuples
-
October 4, 2021 at 12:41 pm #154432
Anonymous
Guestif chains aren’t exhaustive
-
-
-
-
-
-
October 3, 2021 at 7:59 pm #154356
Anonymous
GuestC and C++ have much more developed ecosystems than Rust. C has been around for a very long time and has a lot of use in low-level stuffs, most notably the Linux kernel. Rust is Mozilla crap with a nasty community that acts as a solution to shitty programmers. I can’t see it gaining adoption for major projects already written in C or C++.
-
October 3, 2021 at 8:00 pm #154357
Anonymous
Guest>slow compilation times
>low readability
>high learning curve makes it hard to onboard others
>bloated
>machines, programming, and the real world are inherently unsafe. Rust inversed this principle so you are working with a delusional, backwards model of reality
Only use Rust if you don’t value your time-
October 3, 2021 at 8:04 pm #154360
Anonymous
Guest>write 50kloc of C++
>you’re a genius so the thing almost never segfaults
>overworked
>boss hires junior pajeet to help you
>pajeet’s code corrupts memory, causing weird segfaults no one knows where because no memory safety
>most of the backtraces involve your code
>boss tells you that your code quality dropped since they hired pajeet-
October 4, 2021 at 12:36 pm #154430
Anonymous
GuestVery similar thing happened to me when a pajeet scrote forcibly broke const rules, the very reason I made the parameter a const so that pajeets can’t break it, yet he still bonked up by const casts and memsets. Somehow I got blamed lol.
-
-
October 3, 2021 at 8:41 pm #154365
Anonymous
GuestLow readability compared to what? . It’s a pleasure to read compared to C++
-
October 3, 2021 at 10:41 pm #154371
Anonymous
Guest> and the real world are inherently unsafe.
C Nile cope is getting more amazing everyday
-
-
October 3, 2021 at 8:01 pm #154358
Anonymous
GuestAlready did and the compiler is so helpful.
-
October 3, 2021 at 8:27 pm #154362
s a g e
Guestno
-
October 3, 2021 at 8:40 pm #154364
Anonymous
GuestSorry but I am not a trannie scrote.
-
October 3, 2021 at 9:35 pm #154366
-
October 3, 2021 at 10:25 pm #154370
Anonymous
GuestInteresting, I didn’t know twitter commies hated GNU and Linux. Why do they want to defend corporate interests?
-
-
October 3, 2021 at 10:03 pm #154367
Anonymous
Guest>Learn Rust. NOW.
Dilate. NOW.-
October 3, 2021 at 10:14 pm #154368
-
-
October 3, 2021 at 10:17 pm #154369
Anonymous
Guesthttps://i.4cdn.org/g/1633299478224.gif
@83654050
>t. chud -
October 3, 2021 at 11:17 pm #154372
Anonymous
Guesti hate rust so much, i wish it would die in a fire, along with all the trannies who use it.
-
October 4, 2021 at 1:42 am #154376
Anonymous
GuestI actually quite like rust – the community is absolute cancer though. One of you needs to start a LULZ rust IRC for people who like the language but don’t want to put up with the chud-infested ‘mainstream’ rust community
-
October 4, 2021 at 1:56 am #154378
Anonymous
GuestI agree. Rust is cool and all, but too many vocal lefty chud types have too much to say. The CoC was suppose to prevent scrotebrained politics in the language, not enforce it.
-
October 4, 2021 at 6:18 am #154393
Anonymous
Guest>politics were supposed to prevent politics
did you even read their CoC scrotebrain? Something you’d take out straight from the ass of an actual politician or a gnomish lawyer, someone good at it was paid to write it-
October 4, 2021 at 6:25 am #154396
Anonymous
GuestNo, I have read this code of conduct. The purpose of such guidelines is to create a social structure where people are afraid to speak their minds and turn over their discernment to the collective. The rules and definitions are somewhat vague on purpose. Is this joke you’re telling too offensive, or is it within the parameters? Who knows, maybe it is today, maybe it isn’t tomorrow. If you say something is stupid, is that "ablerist"? Is it offensive towards the stupid? Perhaps, perhaps not. What about "bald faced lie" and the poor bald people? Are you being offensive in the correct way, which is passive aggressive and snarky, but not specifically touching on the specific, arbitrary points that are "offensive" by the changing definitions?
Suddenly all sorts of random colloquialisms and figures of speech is something that gets you a reaction where several people begin a sort of "struggle session" with you to "teach" you how to conform to the collective. And perhaps it’s tolerable to you today, but who knows what they will do tomorrow? People who have found this power of pushing individuals around and feel powerful as the "wolf pack" does never relinquish this power. They need to push it further to get their fix.
Never engage with such groups. They end up like cults.
-
October 4, 2021 at 6:31 am #154397
Anonymous
Guesttake your meds schizo
-
October 4, 2021 at 6:33 am #154399
Anonymous
GuestWhatever. Maybe you should cut back on the meds. You’re probably young and think this is very new and novel, but I have seen this things before.
-
-
October 4, 2021 at 1:41 pm #154464
Anonymous
GuestRust is a cargo cult.
-
-
-
-
-
October 4, 2021 at 2:22 am #154381
-
October 4, 2021 at 6:02 am #154388
Anonymous
Guestmmm all those C and C++ libraries available for consumption
suhweet
-
October 4, 2021 at 6:31 am #154398
Anonymous
Guesthave fun figuring out which thread context the library uses for callbacks or whether you’re supposed to delete this object yourself or if the segfault you got was because you passed a sizeof in bytes instead of an array size or…
-
October 4, 2021 at 6:34 am #154400
Anonymous
GuestI just read the documentation because I’m not mentally ill
-
-
-
October 4, 2021 at 8:14 am #154407
Anonymous
Guest>C, Python, Java above Javascript
Yeah, that’s bullshit. -
October 4, 2021 at 12:50 pm #154438
Anonymous
Guesthttps://i.imgur.com/8ijcYM1.gif
Everything under Top 10 is shovelware trash in this list, change my mind
-
October 4, 2021 at 12:57 pm #154441
Anonymous
Guest>visual basic
>javascript
>php
>not shovelware trash
good programming languages tend not to be popular for the same reason spoken constructed languages tend to be unpopular: no one speaks them. It says nothing about the quality of the language. After all, English is widely spoken despite having incredibly inconsistent pronunciations (for example, ghoti can be pronounced the same as "fish"). English became popular because of the British Empire, not because it’s a good language. Java is popular because oracle spent a lot of money on advertising, C is popular because it came along at the right time and was easier than assembly, C++ is popular because it improved upon C and maintained backwards compatibility, JavaScript because it lucked into being the only language you can run in a web browser. They got popular because of historical accident, whereas a well designed language like Rust can languish in obscurity despite being objectively vastly superior to its competitors.-
October 4, 2021 at 1:19 pm #154453
Anonymous
Guesthttps://i.imgur.com/Z4Bm5Ij.gif
>ghoti can be pronounced the same as "fish"
gas the intellectuals -
October 4, 2021 at 1:22 pm #154455
Anonymous
Guest>English became popular because of the
1611 Authorized Version translation of the Bible authorized by the english king James, with spellings regularized in 1769 -
October 4, 2021 at 6:13 pm #154502
Anonymous
GuestHow can someone cope this hard lmao
-
-
-
October 4, 2021 at 12:51 pm #154439
Anonymous
Guest>VB more popular than JS
lmao anon you are funny -
October 4, 2021 at 1:14 pm #154451
Anonymous
GuestWhy did Fortran leapfrog so high?
-
October 4, 2021 at 1:19 pm #154454
Anonymous
Guestbecause tiobe is utterly meaningless garbage and three people posted fortran shit on HN
-
-
October 4, 2021 at 4:19 pm #154484
-
-
October 4, 2021 at 5:33 am #154384
Anonymous
GuestI started using Go as a replacement for Python in many places for my personal projects. Then recent tried Rust on a whim for one of them after running into some problems with incompetent memory management in the Go wrapper for a library causing segfaults. Rust ended up being a much better developer experience, even with longer build times the other parts of the language make up for it. Go should be a better developer experience but it was designed by people still living in the 80s when they were relevant. Not that it’s all wins for Rust, but the language has just been better designed.
Probably the most embarrassing thing of the direct Rust vs Go comparison is that Rust’s channels are all better than Go’s channels. Go’s channels are a bit faster because they’re simplistic, but channels are always going to be slower than just using locks directly so there should be some focus on ergonomics. Go’s channel ergonomics are freaking trash. All Rust channel implementations have moved to returning Errors on send/receive if all receivers/senders have been dropped. None of this "panic on nil
or "hang forever" bullshit. -
October 4, 2021 at 5:53 am #154386
Anonymous
GuestIt’s core ideas are trash.
-
October 4, 2021 at 6:14 am #154390
Anonymous
GuestI already spent 2 years trying to give it a chance but I’ve been constantly hitting roadblocks due to how immature its ecosystem is and recently went back to C++, I wish I could get my time back, but I’m content with objective truth to myself about the evil of the trannies and why everything they touch turns to blood thinned shit.
-
October 4, 2021 at 6:15 am #154391
Anonymous
Guestdid anybody here write that multithreaded rust code that decodes a message using a grid of # in one file and a grid of characters in another file? there may have been some simd optimizations in there as well. was cool code and hoping to see it again to learn from.
-
October 4, 2021 at 8:05 am #154405
Anonymous
Guest-
October 4, 2021 at 8:10 am #154406
Anonymous
GuestYou could disable libc at that point and write raw assembly using asm!.
-
October 4, 2021 at 10:32 am #154413
Anonymous
Guest>loop{} on panic
Why would you do this?-
October 4, 2021 at 11:33 am #154418
Anonymous
GuestThis code example never actually panics, so it is irrelevant what the panic_handler does.
The ! return type is the never type. You can’t create an instance of it, which means the function never returns.
So the easiest way to provide a panic_handler implementation is to make it an endless loop. There is also an abort intrinsic, but intrinsics are unstable so you ca’t use them from a stable compiler.
-
-
October 4, 2021 at 5:27 pm #154492
Anonymous
Guest>compiled binary size
Hello world is 10 megabytes and 3 megabytes stripped…
-
-
October 4, 2021 at 10:04 am #154411
Anonymous
GuestRust is so fugly and unwieldy that getting used to its idiosyncrasies is just as annoying as in C++, which largely eliminates the benefit.
>muh safety
I’ll use Boehm GC or whatever if I need to.-
October 4, 2021 at 11:08 am #154416
Anonymous
Guestyou’ll use a GC, what about the libs you link to
-
October 4, 2021 at 11:46 am #154422
Anonymous
GuestIt’s a drop in for malloc/free. The point is to be real world usable.
-
October 4, 2021 at 12:47 pm #154436
Anonymous
Guestlol
how will you trace all GC roots when C code can do whatever the fuck it wants to pointers, such as saving them to floppy as ebcdic records-
October 4, 2021 at 12:52 pm #154440
Anonymous
GuestI’ll solve this problem by not using shit libraries, which is impossible in Rust where 3/4 of the ecosystem is alpha quality because the devs got bored and quit the language 2 years ago.
-
October 4, 2021 at 1:00 pm #154443
Anonymous
Guestmuh I only use high quality code written by virgins
ONE wrong byte
that’s all it takes to causes a memory-corrupting bug in your C code
that’s why large C code bases never have been and will never be bug free-
October 4, 2021 at 1:04 pm #154446
Anonymous
GuestI never said I don’t make mistakes. Valgrind exists for a reason.
-
October 4, 2021 at 1:08 pm #154449
Anonymous
Guestthink of rust as automatically running valgrind for a hundred trillion billion years exercising all code paths and possibilities
-
October 4, 2021 at 1:22 pm #154456
Anonymous
GuestThen it turns out some idiots overused unsafe in half of your libraries to speed them up, and replacing them takes more work than using C++ would have been because C++ libraries have the maturity advantage.
-
October 4, 2021 at 1:25 pm #154457
Anonymous
GuestSounds like whataboutism, what kind of libraries have half of them written in unsafe brackets?
Unsafe is not inherently bad, it’s great it can be contained in the smallest place possible, instead of everything being unsafe by default.
-
October 4, 2021 at 1:28 pm #154458
Anonymous
Guest"If used responsibly" is the most meaningless phrase of all time.
I really want to like Rust but it’s simply not going to get people to drop C++ when it’s just as gross and weirdly designed. People prefer the horseshit they’re familiar with. -
October 4, 2021 at 1:32 pm #154460
Anonymous
Guestdoesn’t matter
the pajeet argument applies
you tell pajeet to not use unsafe, easy enough to check
THEN if it crashes it’s your fault -
October 4, 2021 at 1:33 pm #154461
Anonymous
GuestThis kind of ultimate
>I’ll die eventually, so might aswell kill myself now
thinking is what’s wrong with people. More better is objectively better than none.
-
-
-
-
October 4, 2021 at 1:31 pm #154459
Anonymous
Guest>ONE wrong byte
Even in an extremely safe language, a dependently typed one even, you could still have memory corrupting problem due to a cosmic ray flipping the wrong bit. It’s better not to have "safe" languages at all, because safety doesn’t exist in a radioactive universe. We should use unsafe languages and write dangerous code in the knowledge that anything could catastrophically fail at any time. Nothing that can’t fail without killing people should be controlled directly by a computer. If a computer can fire the missiles you’ve already lost, it should be a mechanical system operated by a person.Won’t just enum suffice?
Enums in rust are basically a tagged unions that can contain multiple types.
Eg: https://docs.rs/serde_json/1.0.68/serde_json/enum.Value.htmlEnums can be used for something similar, but notice that the polymorphic return type of out is a. The type information in a value of Proxy a is preserved unlike in a sum type, so returning a tagged union of Int, Bool and String would not be the same thing. The type signature of this would look like
fn out<T> (_: Proxy<T>) -> Tin Rust.
You get a similar type signature for taking the head of a list which is easy enough in rust, so I’m sure Rust’s type system is expressive enough for this.-
October 4, 2021 at 1:34 pm #154462
Anonymous
Guest>it’s okay to write junk cosmic neutroooons flip bits anyway
-
October 4, 2021 at 1:58 pm #154470
Anonymous
Guest>fn out<T> (_: Proxy<T>) -> T
Alright. You can accomplish this in two ways. You can create a generic trait with Foo<T> that had method fn out(_: Proxy) -> T, (or just use Into<T> trait) and write a procedural macro that implements it for each enum variant type.Or you can use Box<dyn Any> that has this functionality out of the box using downcast<T> method and can contain any type(‘static).
>out is monomorphized at compile time, unlike with an enum since the tag is checked at runtime and unlike
else {} is not exhaustive?
In Go this is just
switch c.(type) {
case int:
c = 4
case bool:
c = true
case string:
c = "hello"
} which is just a dynamic type check.
But how can you know in runtime what type does this proxy carry? Is your proxy actually just a container like:
struct Foo<T>(T);If so and if you want to implement some functionality only for specific T, you can just
impl Foo<String> {
…
}-
October 4, 2021 at 2:05 pm #154472
Anonymous
GuestProxy doesn’t contain anything, its type parameter is a phantom. It’s a bit like a static enum I guess. The example I gave is not really useful (well, I suppose you could use it for function overloading, but typeclasses/traits are a better way to do this). This kind of thing is actually quite useful in type-level programming and can do things typeclasses/traits can’t in more sophisticated examples.
-
October 4, 2021 at 3:13 pm #154475
Anonymous
GuestSo, do you just want something like Default trait?
-
-
-
October 4, 2021 at 4:33 pm #154485
Anonymous
Guest>It’s better not to have "safe" languages at all, because safety doesn’t exist in a radioactive universe. We should use unsafe languages and write dangerous code in the knowledge that anything could catastrophically fail at any time.
Maybe a couple trillion bit flips might magically make C work.
-
-
-
-
-
-
October 4, 2021 at 11:54 am #154426
Anonymous
Guestboehm replaces the allocator. libraries will use it too.
-
-
-
October 4, 2021 at 11:00 am #154414
Anonymous
Guestno, i don’t think i will
-
October 4, 2021 at 11:15 am #154417
Anonymous
Guestwhy isn’t there something like openframeworks/libcinder/globject for rust? At most you find nannou but that just gives you raw wgpu and not the nice abstractions (also it takes ages to compile).
-
October 4, 2021 at 4:45 pm #154487
Anonymous
GuestThat’s what’s stopping me from maining Rust
Might as well use Haskell’s GLOSS
-
-
October 4, 2021 at 11:34 am #154419
Anonymous
Guestwhy are trannies such authoritarians? always trying to force others to do things
-
October 4, 2021 at 11:39 am #154420
Anonymous
GuestImagine if you cut off your dick to fit in with your scrote friends on discord, you’d be butthurt and looking to take it out on someone as well.
-
-
October 4, 2021 at 11:44 am #154421
Anonymous
Guest-
October 4, 2021 at 11:47 am #154423
Anonymous
GuestWho and what the fuck is Matz doing?
-
October 4, 2021 at 2:46 pm #154474
Anonymous
GuestThe Joy of Programming
-
-
October 4, 2021 at 11:47 am #154424
Anonymous
GuestWhat an awful diagram, I’ve no idea how to interpret it
-
October 4, 2021 at 12:31 pm #154429
Anonymous
Guesthuh?
Rust is faster than C on 7/10 benchmarks on benchmark game
why has this got Rust apparently slower than C?-
October 4, 2021 at 1:48 pm #154467
Anonymous
Guestat worst it’s 2% slower because it’s 100% correct
most C code doesn’t handle UTF-8 or long file name edge cases or properly check return codes, hence the endless exploits
-
-
-
October 4, 2021 at 12:37 pm #154431
Anonymous
Guest>benchmarking diagram without sources or references
seems legit
-
October 4, 2021 at 12:46 pm #154433
Anonymous
GuestNot him, and haskell because I’m not sure how to do this in Rust, but here’s an example of pattern matching that cannot be replaced with if-else statements
{-# LANGUAGE GADTs #-}
{-# LANGUAGE FlexibleInstances #-} — needed for Eq instancedata Proxy a where
PInt :: Proxy Int
PBool :: Proxy Bool
PString :: Proxy Stringout :: Proxy a -> a
out c = case c of
PInt -> 4
PBool -> True
PString -> "hello world!"It’s probably possible to do something similar in Rust with associated types, but I’m not sure.
We could try and do this with if-else statements and get a compiler error.
instance Eq (Proxy Int) where _ == _ = True
instance Eq (Proxy Bool) where _ == _ = True
instance Eq (Proxy String) where _ == _ = Trueout’ :: Proxy a -> a
out’ c =
if c == PInt then
4
else if c == PBool then
True
else "hello"This approach can’t work, because the compiler can’t know that c can be compared to something of type Proxy Int, when c’s type is Proxy a for some a which could be Int, String or Bool. In general, pattern matching gives the compiler more information about types, and not only that be it results in a compiler error (in rust) or warning (in haskell) if you don’t cover all possibilities in a pattern match expression, which if-else expressions can’t
-
October 4, 2021 at 12:47 pm #154434
Anonymous
Guestmeant for
if len(slice) > 0 {
if slice[len(slice)-1] == "1" {
fmt.Println("!!!")
} else if slice[len(slice)-1] == "z" {
fmt.Println(slice[:len(slice)-1])
} else if slice[0] == "a" {
fmt.Println(slice[1:])
} else {
fmt.Println(slice)
}if len(slice) > 1 {
fmt.Println(slice[len(slice)-2])
}//no tuples
and
-
October 4, 2021 at 12:58 pm #154442
Anonymous
Guestcheck’d
else {} is not exhaustive?
In Go this is just
switch c.(type) {
case int:
c = 4
case bool:
c = true
case string:
c = "hello"
}-
October 4, 2021 at 1:05 pm #154447
Anonymous
Guestwhat is the type of c?
-
October 4, 2021 at 1:07 pm #154448
Anonymous
Guestempty interface
-
October 4, 2021 at 1:11 pm #154450
Anonymous
GuestI don’t know Go, but I googled that and apparently a switch on type "discovers the dynamic type of a variable", which is explicitly not the same thing as
data Proxy a where
PInt :: Proxy Int
PBool :: Proxy Bool
PString :: Proxy Stringout :: Proxy a -> a
out c = case c of
PInt -> 4
PBool -> True
PString -> "hello world!"It’s probably possible to do something similar in Rust with associated types, but I’m not sure.
We could try and do this with if-else statements and get a compiler error.
instance Eq (Proxy Int) where _ == _ = True
instance Eq (Proxy Bool) where _ == _ = True
instance Eq (Proxy String) where _ == _ = Trueout’ :: Proxy a -> a
out’ c =
if c == PInt then
4
else if c == PBool then
True
else "hello"This approach can’t work, because the compiler can’t know that c can be compared to something of type Proxy Int, when c’s type is Proxy a for some a which could be Int, String or Bool. In general, pattern matching gives the compiler more information about types, and not only that be it results in a compiler error (in rust) or warning (in haskell) if you don’t cover all possibilities in a pattern match expression, which if-else expressions can’t
in which there is no dynamic typing.
-
-
-
-
October 4, 2021 at 1:19 pm #154452
Anonymous
GuestWon’t just enum suffice?
Enums in rust are basically a tagged unions that can contain multiple types.
Eg: https://docs.rs/serde_json/1.0.68/serde_json/enum.Value.html-
October 4, 2021 at 1:39 pm #154463
Anonymous
Guestbtw, exapanding further on
in Rust.
You get a similar type signature for taking the head of a list which is easy enough in rust, so I’m sure Rust’s type system is expressive enough for this.out is monomorphized at compile time, unlike with an enum since the tag is checked at runtime and unlike
which is just a dynamic type check.
-
October 4, 2021 at 2:02 pm #154471
Anonymous
GuestAlso if you really want to do some pattern matching you can compare their statically known TypeId and compiler should optimize it away but you might want to drop some compilation hints on your functions to make sure.
-
-
-
-
October 4, 2021 at 12:47 pm #154435
Anonymous
Guest>Learn Rust. NOW.
Not a pedo.
I don’t have petabytes of CP on remote inaccessible disks.
I’m not mentally ill.
Not planning on cutting off my dick, ever.
>You’ll never pass as a woman, ever.
>You’ll never, ever have a period
>You’ll never, biologically speaking, give birth to a child.
>You’ll suicide and join the other 41%.
>You’ll never be a woman, ever. -
October 4, 2021 at 3:40 pm #154477
Anonymous
GuestIm sick and tired of y’all telling yourself that the language(s) you know are the best.
Admit they all have pros and cons, that they are good for different things, and that they are not prefect. There is no language of the future that will replace everything else.
Tips for language stans: learn and *use* multiple languages.
You don’t have to be able to write compile time tetris from memory.DIVERSIFY AND MAKE YOURSELF USEFUL!
For example I know:
* C++, Java, Python, JS, and Go very well
* C, C#, Rust, PHP, and Swift enough to do jobs in itAt my current job, I do like 85% Java but I still have to do things in Python, JS, Rust, and C/C++ all the time.
Once you know like 2 or 3, you can learn them really quickly, and them as you have a use for them, dont try to build a webserver in C or an embedded system in Swift.
-
October 4, 2021 at 3:42 pm #154478
Anonymous
GuestI know twice as many languages as you and maybe I can’t tell which one is the best I am 100% sure Go is shit with no pros.
-
October 4, 2021 at 3:53 pm #154480
Anonymous
Guestit’s not about "learn only rust and nothing else"
learning to use rust and understanding lifetimes and why you get borrow checked will make you a better programmer
it’s about morons that get cucked by the rust compiler, then going back to shit they already know "because they already know how to write safe code", missing the point that no, they do not-
October 4, 2021 at 5:29 pm #154494
Anonymous
GuestRust is for "programmers" who got filtered by memory management – the most important thing a programmer should ever know how to do.
-
-
-
October 4, 2021 at 3:58 pm #154482
Anonymous
Guesthaven’t something like 41% of their language developers killed themselves since the beginning of the project?
I’ll stick with c++ -
October 4, 2021 at 5:06 pm #154488
Anonymous
GuestRust ftw
-
October 4, 2021 at 5:16 pm #154489
Anonymous
GuestSomeone please, without meming, tell me the benefits of learning this language, for someone completely new to programming after learning python. I heard it’s only good for crypto jobs and microcontrollers (don’t know what that last thing is).
Like why should I learn this? I got a free course offer to learn this and haven’t picked it up yet since I don’t know what’s the appeal. Someone please spoon feed me.
-
October 4, 2021 at 5:29 pm #154495
Anonymous
Guest>Someone please, without meming, tell me the benefits of learning this language
It’s more efficient than C (less code, less RAM, faster, smaller binaries). It prevents a lot of common bugs. Firefox uses it. Amazon and other big companies are looking at it because it’s a big improvement over C/C++.-
October 4, 2021 at 5:31 pm #154496
Anonymous
Guest>It’s more efficient than C (less code, less RAM, faster, smaller binaries). It prevents a lot of common bugs. Firefox uses it. Amazon and other big companies are looking at it because it’s a big improvement over C/C++.
Is it used for everything though? Like all things, not just crypto and microcontrollers? Because that’s a common theme and reason I see people take it up for-
October 4, 2021 at 5:34 pm #154498
Anonymous
GuestNone of that was true btw. It’s a shitty mishmash of features taken from other languages, more RAM usage, slower, significantly larger binaries (a hello world is 3 megabytes), and every rust crate is amateurish and full of bugs.
-
October 4, 2021 at 5:41 pm #154499
Anonymous
Guest>None of that was true btw. It’s a shitty mishmash of features taken from other languages, more RAM usage, slower, significantly larger binaries (a hello world is 3 megabytes), and every rust crate is amateurish and full of bugs.
So no point of learning it then?-
October 4, 2021 at 5:43 pm #154500
Anonymous
GuestNot until it improves quite a bit. If I was forced to choose a new language in the same vein, I’d probably go with D instead.
-
-
-
-
-
-
October 4, 2021 at 5:17 pm #154490
Anonymous
GuestANOTHER ONE BITES THE RUST
https://amethyst.rs/posts/amethyst–starting-fresh/-
October 4, 2021 at 5:33 pm #154497
Anonymous
GuestJust use one of the many other 0.0.1-alpha rust game engines sis.
Or realise that rust is the ultimate rugpull lang and stick with languages/engines that have actual proven longevity.
-
-
October 4, 2021 at 5:23 pm #154491
Anonymous
GuestStop promoting Rust to scrotebrained cniles.
I don’t want them in Rust community. -
October 4, 2021 at 5:48 pm #154501
Anonymous
GuestI actually considered learning rust but because of how shilled it is here I decided I’m better off learning another compiled language
-
October 4, 2021 at 6:42 pm #154503
Anonymous
Guestwhen will you join the 41%, chud chud?
-
-
AuthorPosts
- You must be logged in to reply to this topic.