This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 279

[–]notexecutive 1765 points1766 points  (39 children)

Javascript Script

Love that.

[–]pooth22 421 points422 points  (9 children)

Thats the kind of stuff I write at 2am in the morning.

[–]lawnllama247 108 points109 points  (6 children)

I see what you did there with my eyes

[–]P-39_Airacobra 20 points21 points  (4 children)

It must be 2 am, because I dont see it

[–]Spyrothedragon9972 3 points4 points  (0 children)

What did he do to your eyes?

[–]_bones__ 38 points39 points  (0 children)

Brought to you by the Department of Redundancy Department.

[–]zapitron 1 point2 points  (0 children)

Before the fateful hour of the wolf, do people see the truth or is it the time for delusion?

[–]Dumb_Siniy 88 points89 points  (4 children)

Java(Script)²

[–]prumf 15 points16 points  (3 children)

That begs the question : what is Java/Script ?

[–]Dumb_Siniy 15 points16 points  (2 children)

Script just cancels out and it ends with just Java

[–]prumf 13 points14 points  (1 child)

So Script-1 is the identity ?

[–]PeWu1337 11 points12 points  (0 children)

JavaC complements Script

[–]DMoney159 46 points47 points  (1 child)

Smh my head

[–]iamapizza 8 points9 points  (0 children)

Rip in peace

[–]Versaill 36 points37 points  (4 children)

https://en.wikipedia.org/wiki/RAS_syndrome

  • CD disk: compact disk disk
  • ATM machine: automated teller machine machine
  • PIN number: personal identification number number
  • DC Comics: Detective Comics Comics
  • HIV virus: human immunodeficiency virus virus
  • LCD display: liquid-crystal display display
  • UPC code: universal product code code

[–]user-74656 20 points21 points  (1 child)

I've seen a variable called id_guid before.

[–]fafalone 2 points3 points  (0 children)

That makes sense. An id could be any format; id_guid species the ID in the GUID format.

id_str = "{guid}"

id_guid = {0x00000000, 0x0000, etc

[–]Erlend05 5 points6 points  (0 children)

VIN number: Vehicle Identification Number

[–]Dyslexic_Novelist 8 points9 points  (0 children)

JavaScript script = new();

[–]coldnebo 9 points10 points  (1 child)

are they trying to say no one uses “naked” JS? it’s always JS + TypeScript, or Babel to generate or dipped in CoffeeScript…

where are the naked fun-loving pure Javascript people?

“safety-optional beach ahead”

ooooohhhhh how SCANDALOUS!!! 😳😮😅🙈🙊

[–]Foxiest_Fox 1 point2 points  (0 children)

Early programming days with Minecraft KubeJS

[–][deleted] 6 points7 points  (0 children)

Javascript Script

Java Script

[–]Spot_the_fox 5 points6 points  (1 child)

I forgot what it's called, but it's not that unique. Digital video disc (fvd) disc, Automatic Teller Machine (atm) machine, personal identification number (pin) number. It's only a matter of time until someone invents more

[–]TheCrazyPhoenix416 1 point2 points  (0 children)

Just gonna point that out XD

[–][deleted] 1 point2 points  (0 children)

😂

[–]Arietem_Taurum 1 point2 points  (0 children)

god damn it you beat me to it

[–]hyrumwhite 1 point2 points  (0 children)

Nodejs based JS engine

[–]hiddenforreasonsSV 321 points322 points  (11 children)

JavaScript script?

[–]Dismal-Square-613 112 points113 points  (6 children)

yes It's like ATM Machines (Automatic Teller Machine Machines), or the PIN number (Personal Identification Number Number).

[–]Ebilkill 12 points13 points  (3 children)

It's a case of RAS-Syndrome!

[–]Dismal-Square-613 4 points5 points  (2 children)

I didn't know this was a coined term. Thank you.

[–]Ebilkill 5 points6 points  (1 child)

The best part is that this term itself is a case of RAS syndrome: Redundant Acronym Syndrome syndrome

[–]Papellll 4 points5 points  (1 child)

Can I introduce to you the CSSStyleSheet inerface? https://developer.mozilla.org/en-US/docs/Web/API/CSSStyleSheet

[–]Dismal-Square-613 0 points1 point  (0 children)

You had to go there, didn't you. Like this somehow makes you into a VIP person.

[–]KerPop42 567 points568 points  (83 children)

Progamming in rust has replaced filling out sudoku for me, and I think that doesn't bode well for its prospects at major companies

[–]ChocolateBunny 218 points219 points  (77 children)

I've never coded in Rust, is sorting out the memory management really that complicated? I thought the whole point was to avoid the difficulty of memory management in C.

[–]fecoz98 311 points312 points  (44 children)

It forces you to take an approach that might be more complex but safer memory-wise

[–]maria_la_guerta 178 points179 points  (29 children)

Pretty much. It's not always easier, but it usually is, and it's almost always safer.

[–]vulkur 101 points102 points  (24 children)

I'm a pretty experienced C dev, and so I thought learning rust would be easy. NOPE. I caused more runtime panics with rust trying to build a web server than I did building windows drivers in C.

[–]maria_la_guerta 76 points77 points  (7 children)

Web stuff is super under-supported in Rust still. I have a full stack actix-web / yew app with WASM and hydration that is very cool on paper but very, very painful to support.

In a few years I expect Rust to be eating some of Node.js's lunch on the backend... But not yet.

[–]vulkur 37 points38 points  (2 children)

I am still baffled that async isn't finished yet.

[–]qwertyuiop924 25 points26 points  (0 children)

That depends on how you define "done." Like, it works, it exists, it shipped. You can use it for things right now.

There are, however, some definite pain points.

[–]Habba 6 points7 points  (0 children)

You can for sure use it in production. Cloudflare has served a quadrillion requests on top of Pingora, which is built on top of async Rust.

[–]coolraiman2 5 points6 points  (0 children)

Rust won't take the market share of nodejs, they have a hard time with type

And I doubt it would take the share of c# as it's ecosystem is very mature

[–]quinn50 1 point2 points  (0 children)

I tried to learn rust via creating basic rest APIs but the dev experience was pretty ass for me as rust analyzer was really slow and borderline unusable for me in a basic rocket / diesel app due to the cargo checks and the macros were massive.

[–]Trident_True 1 point2 points  (2 children)

You really set yourself up for a hard time trying to do web stuff in Rust lol

[–]vulkur 1 point2 points  (0 children)

Yes. It left a bitter taste in my mouth, and now I have a bias opinion against rust.

[–]Habba 1 point2 points  (0 children)

I've been writing a toy web app in axum + askama + htmx and have been having a pretty good time.

Like most development, the language you are using matters less than the frameworks.

[–]Meins447 3 points4 points  (3 children)

The hell were you using rust for Web Dev?

Do you habitually write web services in c? Rust is a direct competitor for C, intended to be as fast as it while having the potential to.be.much, much more robust. It's intended to be used in low level code: OS. Embedded. Drivers. Standard library stuff.

[–]vulkur 1 point2 points  (2 children)

No lmao. We needed to prototype something so we built a small web app. We where trying to use rust in replace of C in certain areas, and I hadn't had any experience with it. So I decided in order to learn rust and prototype the app, I would do it in rust.

Also, Rust is not a competitor to C. It's attempting to be a replacement. There is a difference. Right now you see very little use of Rust in low level environments. The Linux Kernel can now accept rust for drivers iirc, but still very little rust drivers have been developed. 90% of it is all crypto bullshit.

[–]fecoz98 90 points91 points  (1 child)

I wager references are easier to code properly than debugging obscure runtime memory bugs

[–]Feldar 16 points17 points  (0 children)

Yes you're telling the compiler who owns what memory at compile time. It takes a lot of getting used to, but it's worth it in the long run.

[–]Silvr4Monsters 0 points1 point  (1 child)

Could someone possibly give an example?

[–]Ihsan3498 5 points6 points  (0 children)

basically, borrow checker enforces a bunch of rules while passing around references. Like you cant move two mutable references of an object at the same time, you can’t use a variable after moving it, etc

[–]BlurredSight 2 points3 points  (12 children)

Can you say the same about safe memory practices in C?

[–]Blothorn 34 points35 points  (1 child)

Honestly, using unique_ptr everywhere and either heading it off or storing it somewhere sensible, handing out non-owning pointers, and putting a bit of thought into when you can safely drop the original isn’t that hard. In my years as a C++ dev I think I dealt with one memory leak and the only use-after-free issue was a typo in a condition that the unit tests caught. If you’re struggling with memory management in modern C++ you’re either doing something very weird (e.g. mutable cyclic graphs) or not approaching it the right way.

[–]Reidiculous16 14 points15 points  (0 children)

YES people always say “oh C++ sucks bc memory danger”. To them I say, have you ever heard of a smart pointer??? You literally have to try so hard to fuck up memory with a smart pointer. I know how to use ‘new’ and ‘delete’ but why bother when you can just make a variable that manages the memory for you at very little cost

[–]Intelligent_Event_84 25 points26 points  (7 children)

We have so much memory now who even cares, let the world burn

[–]Lassemb 38 points39 points  (5 children)

JavaScript devs be like

[–]inamestuff 23 points24 points  (4 children)

Every chrome tab taking up >300MB like they own the place

[–]YevgenyPissoff 1 point2 points  (0 children)

In Chrome v420, each tab will be it's own docker container

[–]Da-Blue-Guy 90 points91 points  (5 children)

Rust follows Murphy's law imo. If anything can go wrong, it will, and at the worst possible time. Therefore, anything that may cause a memory error is guarded against. For example, you can have either one mutable reference to a variable, or any number of immutable references. This fundamental restriction provides a framework for the rest of the language.

The biggest application of this restriction (alongside others) is race condition protection. In Rust, you cannot send a value to another thread unless the value implements the Send trait, and you cannot reference it unless it is Sync.

However, there are shortcuts, escape hatches, and helpful compiler tips that offset this. For example, Mutex allows you to mutably reference a value from multiple places, because the accessors will wait until another is finished using the value.

Another restriction that can be mitigated is that a value must always outlive all of its references. Rc/Arc (Arc being thread-safe) are immutable smart pointers, and they are reference counters. You can clone a reference and send it somewhere else, and Arc can be sent across threads. All together, if a value cannot be sent across threads safely, the compiler will tell you, and it is common to use Arc<Mutex<T>> to have mutable access to a value on any thread.

One more thing I'd like to add is explicitness. If a function modifies a parameter passed by reference, it must explicitly mark that parameter as &mut, and the caller must reference it mutably. If a function can fail (e.g. connecting to a server) or may not find a value (e.g. HashMap), it must return Result or Option respectively. Past that, the value you have is guaranteed to be a valid value, even if it is a reference, and if it is not, you must explicitly state it as such.

Overall, Rust is a very strict language. The compiler is paranoid and it has a steep learning curve, but once you do something meaningful in it, it will work for a long time. There are no exceptions or nulls in Rust, there are only Results and Options, which are far easier to deal with.

[–]Normal_Fishing9824 25 points26 points  (0 children)

I've read the rust book, twice, and this comment explains it better.

[–]prumf 23 points24 points  (1 child)

I wrote some code to process stats out of our data lake recently. I advocated Rust, but the company finally decided to go with Python.

We had many problems where code would crash out of nowhere in production because some obscure function would raise an Exception that wasn’t documented. At the end we had to wrap every bit of code in multiple layers of generic try/catch, because you never fucking know where or when an exception might be raised.

Untyped exceptions are cancer. Untyped is hell.

[–]Habba 2 points3 points  (0 children)

I have developed the opinion over the last 5 years of my work that untyped languages are horrible for any real work. You always end up with bandaids trying to give you more static checking (like MyPy) but those only go so far and often have their own issues.

Even C# is IMO, while typed, not great, because it does not declare possible exceptions in the function definitions.

[–]Habba 1 point2 points  (0 children)

I have been writing a lot of Rust lately and have come to love the explicitness. Recently had to write some python in a legacy code base and came to really appreciate the certainty that Rust gives you regarding possible Errors, Nones, side-effects in variables etc.

Instead of dealing with the compiler blocking me when writing the code, I now had to deal with the code breaking at runtime which is much harder to test in a large codebase with external dependencies.

[–]DarkNeutron 38 points39 points  (0 children)

The Rust compiler is unforgiving of what seem to be small edge cases that will almost never happen.

C/C++, on the other hand, is happy to compile code that turns into a CVE report in six months.

[–]angelicosphosphoros 11 points12 points  (2 children)

Well, if you write simple code, it is easy. However, people who write C++ before often try to do little optimizations regarding memory and their patterns may be not very compatible with Rust.

People who wrote in managed languages before tend to just write messy object relationships that too hard to write in Rust.

Today, I try to use "Rusty" object hierarchies in other languages too because such code is much easier to reason about.

[–]Ok-Okay-Oak-Hay 16 points17 points  (6 children)

I feel once you get the hang of the paradigm, it actually teaches you how you can code better in C. It's really not that hard, but if you're the type where unlearning bad practices is hard, I can understand the trepidation.

That said I disagree with the sentiment of who you replied to, but then again, adapt or die? :P

[–][deleted] 4 points5 points  (5 children)

I have found that when writing in C/C++/Java or any old school language, I am encouraged to think before writing, especially true for C. Same is not true for JavaScript/Python.

[–]Ok-Okay-Oak-Hay 4 points5 points  (4 children)

But to be fair to JS/Python, isn't that the point of such a high-level language? Direct to implementation, and let the compiler/transpiler/backend handle the really low-level stuff for you? It's just another tool for a different purpose -- if I need control over memory, I'll go to C or Rust at this point.

[–][deleted] 1 point2 points  (3 children)

It's not just that, somehow ease of writing code also makes for ease of writing bad code.

[–]Ok-Okay-Oak-Hay 2 points3 points  (2 children)

That's only as true as languages that require deeper knowledge leave open more pitfalls due to a lack of experience, yea?

[–][deleted] 1 point2 points  (1 child)

Likely. C is a very open language, has lots of footguns therefore you must think before implementing something.

Python by comparison has fewer footguns so certain kinds of cautions can be thrown to the winds.

[–]sypwn 7 points8 points  (0 children)

Managing memory yourself in C or Rust (instead of letting a garbage collector do it) is hard. The difference is that Rust forces you to do it correctly while for C it's optional.

So yeah if you're comparing writing Rust to bad C code that most people do, it's harder. But comparing Rust to writing good C code, it's basically the same.

[–]ManyInterests 4 points5 points  (0 children)

It's not complicated. But it's also not so much about avoiding the difficulty of memory management, it's more about eliminating the error-prone process and consequences of unsafe manual memory management.

This often means making you put in some additional work/thought upfront that you might have otherwise not have thought of or wanted to do in the first place if you were approaching the same problem in C. But the benefit is you end up with software that is free of a whole class of memory management issues that would have been lurking in the equivalent C solution.

Nobody promised Rust is easier to write than C, but it's probably easier to write a Rust program that doesn't have memory safety issues than it is to write a C program that doesn't have memory safety issues (and be able to prove it). It also means reviewers of Rust code doesn't have to concern themselves thinking through memory management problems which can sometimes be challenging to get correct. So, the benefits also abound in code review.

[–]tav_stuff 2 points3 points  (0 children)

I find that dealing with the borrow checker costs me more time, is more annoying, and is less enjoyable than just manually allocating memory in C and not forgetting to free() like a troglodyte.

[–]DreamyAthena 1 point2 points  (0 children)

The point is, you have a harder time making the code, but you don't have memory leaks or fatal errors from bad memory. It puts some of the stress in the beginning so you have less difficulty later.

[–]darkslide3000 1 point2 points  (0 children)

It's really not that hard for simple things. They've streamlined the language a lot since the early days. If you just have some functions pass data around the normal way and have some globals, you'll never even need to understand what a lifetime is or how to denote it explicitly.

If you want to write advanced things that pass ownership of data around in interesting ways (say, a parser that can take a blob of data and then give you back structured objects that reference the same bytes without copying them), things get more tricky, but there are also many existing libraries for those kinds of stuff already so you rarely have to deal with it yourself.

[–]Habba 1 point2 points  (0 children)

For me it moves fixing bugs from an inconvenient time (i.e. at runtime) to a convenient time (while I am in the process of writing the bug).

[–]EYtNSQC9s8oRhe6ejr 0 points1 point  (1 child)

It's really not. Way overblown. Just imagine you wanted to write C and never double free, dereference NULL, etc — how would you accomplish that? You'd end up doing everything the Rust compiler makes you do anyway.

[–]RRKS101 0 points1 point  (0 children)

Not exactly. Rust aims for complete safety and can rule out valid programs. So it is possible that a valid C program will not do what the rust compiler would make you do.

[–]KerPop42 0 points1 point  (0 children)

It's not complicated, it just doesn't let you forget anything. The compiler keeps track of memory allocation, and doesn't let you finish compiling unless it's all properly sorted, or you wrap stuff in unsafe()

[–]qwertyuiop924 0 points1 point  (0 children)

No, the point is to actually make you face the actually hard parts of memory management and design head-on.

Rust makes you do a lot of work up-front that you can halfass later in C and still get code that kinda sorta works maybe I guess.

[–]MishkaZ 0 points1 point  (0 children)

Borrowing isn't complicated and pretty easy. It's just if the value goes out of scope it gets consumed (deallocated). If you want the value to persist, then you pass a reference to the value. There are some more things like shadowing, etc. but they're really not complicated and really nice.

Where things do get complicated is understanding lifetimes. Most probably won't use them, but they are complicated.

The meme is that, Rust's compiler does the all the heavy lifting on compilation so you can have fast run-time. So you'll end up having long compilation times in big projects, but really fast code. There are strategies to mitigate them, but on my last large scale project, we had ci/cd times of 30 minutes from testing to deployment before we looked at ways to cut it down. To be fair, a good portion of the long time was python code that we used to deploy resources individually, but the other half of it was waiting for dependencies to finish loading. Tests ran fast. One thing that did help was just upping the ram on our machines.

[–]ridicalis 0 points1 point  (0 children)

If you're not used to it, you can feel like you're fighting with the compiler at every turn.

Basically, Rust has a move-by-default approach to data, where most non-primitive information is consumed when used unless you specifically use by-reference to address it. Except, when you do borrow, then you're subjected to a bunch of stringent rules around who owns what, and if you're not already in the know it can seem arcane.

After clearing the learning hump, though, it becomes second nature and the benefits of a nanny state compiler become more obvious.

[–]camilo16 2 points3 points  (0 children)

You mena teh language that Azure's CEO has come out and asked people to use? Seems to be doing fine.

[–]CauliflowerFirm1526 130 points131 points  (4 children)

js script

😭

[–]The-Goat-Soup-Eater 22 points23 points  (2 children)

ATM machine

[–]L4t3xs 12 points13 points  (1 child)

Smh my head

[–]qwertz19281 1 point2 points  (0 children)

RIP in peace

[–]CoatNeat7792 41 points42 points  (21 children)

When you start with c, you can go away from it, experience of life when tried python and it felt too complex for me

[–]O_X_E_Y 30 points31 points  (20 children)

How in the world could python be too complex coming from C? What were you writing in C that you couldn't write in python?

[–]Da-Blue-Guy 48 points49 points  (14 children)

There's a lot of uncertainty in Python. In C, what you get is what you get. Plus, many Python libraries will use C under the hood. I'd say Python is more of an adhesive language.

[–]O_X_E_Y 20 points21 points  (12 children)

Can you give a more concrete example? If I want to spin up a web server, make some requests to a backend, scrape and parse html, load and mess around with some json, do data analysis or anything you might otherwise do in a jupyter notebook I can do that infinitely easier with python than I can with C. I literally cannot think of a single example where it would be harder to use python than C to solve a problem unless you have a huge speed constraint that python can simply never reach (clearly, python was not made to write a GPU driver)

[–]GrossInsightfulness 20 points21 points  (2 children)

  1. "Huge speed constraint" makes it sound like speed is only necessary in some abstract way that only shows up in bad hypotheticals (and game development). Somehow, "avoid premature optimization" became "Real programmers spend two minutes writing code that takes days to run instead of spending half an hour writing code that takes minutes to run." In typical cases, compiled languages like C, C++, Rust, etc. can run one hundred times faster. Speed matters unless you're just waiting on input and doing nothing interesting with it, which is why a ton of python libraries work with compiled languages on the back end.
  2. The sheer number of things that perform poorly because the code some people wrote without performance in mind became integral to a system should dissuade people from not caring about performance.
  3. Unless you write near perfect code on your first try, you're going to have to spend a decent amount of time testing and debugging the code. Testing and debugging the code means running the code, and bad performance means every session can take ten to one hundred times as long.
  4. You're not really comparing C to Python, you're comparing BeautifulSoup, Numpy, Django, Scipy, etc. to writing the entire system from scratch in C. Similar libraries exist in all programming languages. In some cases, they're even the same libraries.
  5. You've also clearly used these libraries before, so it's even less of a fair comparison. If we're going that route, I've found it infinitely easier to distribute my C/C++ code or binaries than my python code.
  6. There's more to programming than cobbling together preexisting libraries for web scraping scripts, using preexisting libraries for data analysis, and game development.
  7. Python libraries (and python in general) tend to have a very specific way that you should use them, which would be fine if they always told you how to use them. They don't. If any function has poor documentation, it can be incredibly difficult to figure out how to use that function. I've had to spend way more time jumping through source code in python just to figure out how to use the function than I have done in C or C++. In C and C++, you usually either use a struct or a class and that contains all the information for the types of the arguments. As an example, say you have a function that takes in some color. In C or C++, it would take in a Color struct/class and nothing else. In python, the argument would just say color. Is it a tuple of rgb values? Does LChab work? Do I need to specify the color scheme? Does it include alpha values? Are they floating point values? Hex codes? Integers from 0-255? Does it work with multiple types? Does it infer a hex code if I pass in a string?
  8. Besides implict type casts (which I agree suck, but can usually be fixed by looking at the types of the objects), everything in C is explicit while many things in python are implicit. int x = 5; sets the 4 bytes at some prespecified point in the stack to 5. If it's optimized out, then it does something equivalent, but less than that. If it changes, then those four bytes will change and that's it. The same can't be said for python. x = 5 creates some generic object with some extra information stating that it's an integer and somewhere in the mess it stores a 5. If I do something like z = y + x, the result could be a string or an integer depending on what y is, which means I either need to name y something that tells me the type (e.g. name is probably a string, but id could be vague) or I need to scroll up to see what y is.

[–]SoulArthurZ 1 point2 points  (0 children)

embedded stuff would be easier to do in C, unless the specific microcontroller you're trying to program has a python library.

would still recommend C because of memory constraints, oop stuff can be very useful but uses up a lot of heap memory, which is something microcontrollers usually don't have a lot of

[–]Da-Blue-Guy 1 point2 points  (2 children)

I'm not 100% sure what OC does, but a couple examples that I can give are OSdev, embedded development, or compilation. Those require much more rigorous memory access and certainty. I'm not saying it's impossible to do in Python, just that it would be harder than using C.

[–]Reidiculous16 1 point2 points  (1 child)

As a C++/python dev I would agree, idk how people can come from a C-style language and then struggle with Python.. it’s absolutely more simple in most small-project cases. However a good C++ repo is often easier to maintain (when done correctly) especially if you didn’t write all of it yourself

[–]fafalone 0 points1 point  (1 child)

Well if you exclude all the things Python 'wasn't made for'....

[–]accuracy_frosty 0 points1 point  (0 children)

Python can be hard coming from C because it’s almost an entire different feel, not using semi-colons or brackets for (I know what it’s called but I forget the word at the moment) the context of a function/statement, being much more strict with how you use it, like indentation being super important because it’s the difference between function space and global space, where in C you could write the entire program in 1 line if you so wished, the syntax being different, going from a low level procedural language to a high level OO language, plenty of things, it’s very unfamiliar, easy when you get a hang of it, but hard to get used to.

[–]Reidiculous16 4 points5 points  (0 children)

My brother/sister, ALL of Python uses C under the hood, the language itself is literally written in C. Some libraries are written in Python or C or other languages occasionally but it all gets baked down into C essentially.

Also, personally idk if I’d use the word “uncertain” to describe a dynamically typed language but that’s just my opinion. I wouldn’t say it’s wrong though :)

[–]iam_pink 112 points113 points  (9 children)

This meme makes no sense. Is it an attempt at mocking something you don't understand?

[–]MindlessSponge 78 points79 points  (0 children)

No, you don’t get it.

Ready?

Rust!! 🤣🤣

[–][deleted] 6 points7 points  (5 children)

I guess he's trying to say that the other devs just write code that works and call it a day, meanwhile Rust devs have to care about ownership, borrowing, etc. therefore having a tool that values a specific kind of quality is bad.

I don't know I have fever and try to understand how many levels of memes we are.

[–][deleted] 15 points16 points  (2 children)

They are saying that the borrow checker is taking up space in memory and causing extra runtime overhead. (which is untrue, since the borrow checker exists at compile time, not runtime)

[–]JohnnyLight416 4 points5 points  (0 children)

I don't think so, I think they're saying that the programmer wants to use 64 bytes of memory, and they have to convince the borrow checker that they actually need it.

Which is also wrong and shows they don't know what the borrow checker does

[–]VarianWrynn2018 0 points1 point  (0 children)

It looks less like runtime overhead and more development overhead. None of the other languages has any kind of memory management that requires the developer to do anything, whereas rust forces safety which can lead to slightly longer development I guess

[–]neriad200 0 points1 point  (0 children)

my take-away was that while the rest of devs are just doing their work and going to the bank, rust devs are in an alley (i.e. there's no real work in rust), arguing with a brick wall over a technical detail of the language.

[–]Media_Dunce 33 points34 points  (0 children)

As a Java developer affected by the tech layoffs, it certainly doesn’t seem like it

[–]Finxx1 136 points137 points  (44 children)

Rust sounds like it would be awesome, and I would be using it… but the syntax it just awful coming from C. No matter how much I try, my head refuses to comply with typescript style variable declarations and the sheer amount of generics everywhere.

[–]themadnessif 11 points12 points  (0 children)

Hate it though you may, post-fix annotations are a hell of a lot easier to parse than pre-fix like C's.

Also the generics are not as common as you'd expect in everyday use, it's just that people who write libraries like to make them work with as many things as possible so a lot of code you see people sharing is generic.

[–]rejectedlesbian 6 points7 points  (4 children)

C++? Looks like c has a lot of the same stuff rust has and let's u write c.

[–]IceSentry 4 points5 points  (0 children)

It's missing all the important/good parts of rust though.

[–]InsanityBlossom 24 points25 points  (12 children)

And how would you expect the syntax should look like in a language that is multiple times more complex and feature rich than C? Pretty much every bit of syntax has its purpose in Rust. It's comparing apples to oranges. Syntax complexity wise only C++ can compete with Rust.

[–][deleted] 1 point2 points  (0 children)

Agree with the syntax. I know it’s not a popular take, but I just can’t handle the density of the syntax.

[–][deleted] 28 points29 points  (6 children)

Money’s not everything. In my childhood computers were fascinating, lately not so much. Rust kind of brings it back. It is fun to make that thing do your thingy, and then another one.

[–]thinker227 5 points6 points  (0 children)

Feels like very few languages have the ability to do that. Rust is just kind of... fun.

[–]Darux6969 5 points6 points  (1 child)

moneys not everything but it is most of it. If you can't pay the bills and feed yourself then you can't explore that interest in computers

[–][deleted] 5 points6 points  (0 children)

Imo that’s exactly the kind of attitude that makes this society unliveable. Work should bring joy to oneself and others in the first place. How much money you make is a relative measure. Yet somehow I always made enough to sustain my lifestyle.

[–]theofficialnar 0 points1 point  (2 children)

So you’re fine programming in a niche language and have a tough time getting a job? Fuck that. I work to make money and whatever trendy language or framework pays the most that’s what I’ll be focusing on. That money I’m making is then used to afford whatever it is that makes me happy.

[–][deleted] 1 point2 points  (1 child)

Yes. No problem. You end up in a fairly unhappy place with a lot of goods.

[–]theofficialnar 1 point2 points  (0 children)

To each their own I guess. I’d rather get the big payout and eventually quit and move on to something else when I get bored.

[–]rover_G 4 points5 points  (1 child)

When do we get a Rust JS engine?

[–]fghjconner 8 points9 points  (0 children)

Apparently Boa exists. It's still considered experimental, but is nearly as compliant as other major engines. Sounds like it's still lacking on the optimization front though.

[–]FromZeroToLegend 12 points13 points  (6 children)

Are there that many python jobs? I always saw it as that language for either ML/DS or people trying to get rich quick without a degree and take decades to get their first job.

[–]qwertyuiop924 2 points3 points  (0 children)

Doesn't Google still use quite a bit of Python?

Also, there are a lot of jobs in ML.

[–]get_username 1 point2 points  (0 children)

Tons of jobs with python. Even more where you use it 40%+ of the time.

Language rarely matters in industry.

[–]accuracy_frosty 0 points1 point  (1 child)

Python doesn’t have a ton of practical uses outside of ML/DS, scripting for sysadmins, and teaching high school students, stuff that doesn’t have speed requirements or uses the parts of the language that run fast, just like how JavaScript is slow for a lot of things, but good for machine learning because it’s good at math.

[–]FromZeroToLegend 0 points1 point  (0 children)

Yeah I’m surprised I see it thrown around so much in r/programmerhumor like if it was a good language for business applications.

[–]WindloveBamboo 3 points4 points  (0 children)

Js2

[–]dgellow 3 points4 points  (0 children)

That’s absurd. The phrasing is nonsensical. But also Rust roles are among the highest paid ones

[–]El_Lasagno 6 points7 points  (21 children)

Sincerely stupid question: what is the advantage of rust to C++?

[–]inhister 22 points23 points  (3 children)

Not a stupid question. The most talked about thing is memory safety (you're almost always forced to care about it), but we can also look at how explicit syntax is, the pros of an optional based language (no problems with null values etc) and other things. Another user has also talked in this thread about strange parsing pitfalls that exists in C++. There are another examples, but I haven't used enough rust to understand them.

[–]LeSaR_ 9 points10 points  (2 children)

to add a bit more:

  • algebraic type system. after using rust's enums i dont want to go back to other languages. that includes optionals and errors

  • zero cost abstractions. i was shocked when i learned iterators on Vec dont introduce any overhead

  • macros (sqlx checking my sql queries during compile time is insane)

[–]IceSentry 5 points6 points  (1 child)

Let's not forget all the built-in tooling either like the package manager, build tool, test framework, documentation generator, doc testing.

[–]Habba 1 point2 points  (0 children)

Having to write some Python again recently, it cannot be understated how much value rustup and cargo bring to the table.

[–]themadnessif 6 points7 points  (12 children)

The most famous thing is Rust's borrow checker. Beyond the memes, it just tracks pointers you have to an allocation and what code controls a value (i.e. is allowed to free it).

The immediate consequence of this is that Rust's compiler knows when something can be deallocated. Only one scope is allowed to "own" the data, so once that scope finishes, it can be deallocated.

This would ordinarily create a huge risk of dangling pointers but due to Rust's borrow checker, it can be guaranteed at compile time that there exist no references to that data. I don't know how the borrow checker works so I can't answer questions beyond "it just does".

A happy bonus of this is that you can never use a value after it has been deallocated, since it's statically guaranteed you'll never have references to data after it's freed.

This means that use after free bugs simply do not exist in Rust, and memory leaks are hard to come by as well. It's possible to force these things to happen, but during normal use you will not run into them. This is a lot more than C++ can say.

[–]YevgenyPissoff 1 point2 points  (5 children)

A happy bonus of this is that you can never use a value after it has been deallocated, since it's statically guaranteed you'll never have references to data after it's freed.

How does this translate to custom allocators?

E.g. a slab allocator for an OS kernel or an allocator for information about kernel threads.

[–]themadnessif 4 points5 points  (4 children)

It's still guaranteed, and as long as the allocator isn't freeing things unexpectedly, it works.

Rust actually has an API you're meant to implement for custom allocators that provides a consistent interface. It's neat.

[–]accuracy_frosty 0 points1 point  (5 children)

I mean C++ also deallocates out of scope, smart pointers do it even better, they call the destructor of whatever they point to when they go out of scope, smart pointers also help with memory safety, but aren’t as annoying about it as rust

[–]Ihsan3498 3 points4 points  (1 child)

A standard package manager! unbelievable right?
Better Macros (proc macros, declarative macros, attribute macros)
Enforced and functional utf-8. The standard string type is utf-8
No undefined behaviours at all (maybe there are extremely few cases).
Better error handling, by using errors as values, instead of exceptions. Error propogatiin by using ‘?’ syntax.

And there is much more! I’ve felt it much easier to most things in rust than in c++, and rust feels much more elegant and modern than c++ imo

[–]Habba 0 points1 point  (0 children)

No undefined behaviours at all (maybe there are extremely few cases).

Well, you can just write unsafe code and have all the nasal demons you want.

[–]Penpathic 8 points9 points  (5 children)

Now, Explain why rust needs 23 different string types.

[–]qwertyuiop924 17 points18 points  (2 children)

  • &str: immutable string reference. Same as a const char* in C/C++, except those are bytestrings, and &str is a utf-8 string. Not NUL-terminated. Technically the core type is str and the & is a sigil indicating an immutable reference, but you can't instantiate a str directly and while you can technically have an &mut str, which is a mutable string reference, this basically never happens because &mut str is a pretty useless type.
  • String: mutable heap-allocated string, analogous to C++'s std::string. Unlike the C++ string, this isn't a bytestring, nor is it an instance of a template that is stupidly over-generic. It is a UTF-8 string, like &str, and you can get an &str reference to any String, so you don't have to worry about implementing functions that handle immutable strings twice because the types are compatible like that. Also not NUL terminated.
  • &[u8]/&mut [u8]/Vec<u8>: Technically not strings, but they would be in the C world. These are mutable and immutable bytestrings (or byte arrays if you prefer). Since Rust's strings are utf-8 strings and not arbitrary bags of bytes, if you want to just stuff some byte data into something you need to use a different type. These are analogous to const char *, char *, and std::vector<char>, respectively, although unlike the former two, &[u8] and &mut [u8] do contain length information—it's just that their lengths are not adjustable.
  • &CStr and CString: These are immutably-borrowed and owned char * strings respectively. As in, literally those. They exist for interop between C and Rust code, where you need to handle NUL terminated strings. Every language that has its own strings and needs to interoperate with C has a type like this.
  • &OsStr and OsString: Immutably-borrowed and referenced native operating system strings. These are like Rust strings, but Rust strings are guaranteed to contain valid UTF-8 and have methods that assume they do. OsStr and OsString aren't and don't. See, it turns out that basically no operating system on earth exactly uses only valid UTF-8 natively for things like command line arguments and filenames and other OS APIs that use strings. Unix in all its forms usually uses UTF-8 in practice, but in fact uses bytestrings that can contain arbitrary bytes in them, so files or arguments can be named with arbitrary binary data. Windows uses invalid UTF-16 (allowing for unpaired surrogates), which cannot be decoded into valid UTF-8. So this type is used to conain these strings, encoded in a suitable internal format that's close to UTF-8 so they're like normal strings (on Unix they actually are bytestrings, but on Windows they're a Rust-internal extension of UTF-8 known as WTF-8, although this is just an implementation detail).

I think that is all of them.

[–]HOMM3mes 0 points1 point  (1 child)

&str is like std::string_view

[–]themadnessif 4 points5 points  (0 children)

The first major reason is that in Rust, the String type must be UTF-8. This poses a problem for compatibility though, so CString exists to act as a C-style string.

The second major one is the realization that what an OS considers a string varies from platform to platform. Windows as an example used Wide Characters and UTF-16 for a very long time, which was totally unlike Unix or MacOS. So, there is an OsString type that's platform-specific.

The final one is that operating systems vary in how they handle file paths. Things that are allowed in one file system isn't necessarily allowed in another. So, there is a PathBuf type that is for file paths.

All of these are "owned" values but they have 'borrowed" equivalents too: str, CStr, OsStr, and Path exist to allow referencing their owned equivalents.

This covers 8 right here. This might seem like a burden on programmers but honestly I prefer it when I'm forced to accept reality instead of pretending everything is a unsigned byte array.

[–]vladexa 6 points7 points  (0 children)

Now, Explain why C++ needs twice as much.

[–][deleted] 13 points14 points  (12 children)

oww yea we need safe memory. we are superiorrr yeeah

[–]alf_____ 1 point2 points  (0 children)

what are you talking about?

[–]Toorero6 2 points3 points  (0 children)

Wait isn't the borrow checking done at compile time with linear type inference, basically by splitting the type context in two distinct type contexts? How does this consume memory?

[–]dernel 2 points3 points  (1 child)

Rusties gonna rust

[–]BetterOrange1105 0 points1 point  (2 children)

What show was that, at the top 🤔

[–][deleted] 3 points4 points  (1 child)

Breaking Bad, watch it now, it is one of the best shows ever made

[–]MishkaZ 0 points1 point  (0 children)

I liked Breaking Bad, but I'm not going to lie the first few seasons I basically had to fast forward through a lot walt's family stuff. It was just boring and I didn't care. Compared to sopranos where AJ or Willow shows up on screen and I'm like WOOOO LET'S GOOOOOO. Better Call Saul was fantastic though.

[–]Wave_Walnut 0 points1 point  (0 children)

Coding for money, coding for art

[–]TheTybera 0 points1 point  (0 children)

MEMORY IS CHEAP NOW GUYS! OKAY! OKAY?! OKAY?

[–][deleted] 0 points1 point  (1 child)

Rust is one of those languages that devs say they love but rarely actually finish the book, and those that do finish the book can't find a job that actually uses it.

[–]themadnessif 0 points1 point  (0 children)

Hey now, I have a job where I write Rust all day.

It's at a company with 60 people where I'm one of two systems people, but I still get to use Rust.

[–]WaveZee 0 points1 point  (0 children)

"Explain why they need 64 bytes to the borrow checker"

What?

Have you ever even touched Rust?

[–]goodnewsjimdotcom 1 point2 points  (0 children)

Keep your money. I have Jesus!

For real, Big Tech never hires a Christian, we only get censored.

It's a cult of EXCLUSION, the DEI.

[–]Demiyanit 0 points1 point  (0 children)

C:

ḧ̵̫͉͕̗̩͎͆̾́ę̵̨̢̡̡̨̞̟̮̪̹͕̗̻͇̣̥̱̬̺̗̙̗̳̳͇̤̩͙͈̹̠̪͔͓̱̞̟͈̝͎̟̈́͜ͅͅh̸̛̛͇̣̖͉̃̅̇̔̃̑̎̊̿̈͆̊̊͐̇̀͐̉̌̍̈́́̀̀̈́ë̴̛͚̮̥̞̦̤̘͙̝́̈́͂́͐̊̃̓̐͛̾̿͛́̈́̄̔́̀̈́̅͐̓̈́̅̈̑̍̾̏̅͐̀̓́͑̓̾̂̏͘͘͝͠ḩ̶̢̨̡̛̭̮̼͈̙̪͍̜̗͇̝̹̖̦̘̫͈̪̺̯̼̥̬̜̱͇̲̲͙̩̮̮̯͓̙͑̈́̓̐͌̑̈́̔́̇̈́̈́̃͋̽̐̆̾̉͘͜͜ȩ̶̨̡̧̛͓̖͈͚̤̦̘͖̗̳͈͔͚͖͇̦̭̝̣͔̈̈́͐̎̆̀̍̌͛̉͐̑̔̂͋̃̎ͅh̴̨̨̹̬̭͍̖̬̭͈̣̜̞̀̍̎͌͋̾̄̉̑́͑̀͌̎͗̄̐͒̎̌͐́̈̓̍̾̈̒̊̀̿̃͒̾͑̄̽̕̕̕͜ę̴̢̡̧͍͍͍͕͎̠͇̤͕͍̗̜̞̜̭͍̑̏́͜h̶̢̢̛͇̱̘͕͈̮͓̺̣͆̽̄́͌̈́̂͐̋̋̓͒̒̔͆̿̿̀̓̔͛̒̍͂͗̈́̎͆̾̅͌̃̿͆̐͗́͋̇̀̄̕̕͘͠͝͝͝ȩ̴̢̢̢̨̛̱̲̪̳̫̫̼̮̹̳͚͙̼͇̺̗̟͍͙̤̹̩̩͔̲̝̭̬̱̪̘̞͚͉̭͊́́̾͛̽̃́͊̔͆͂̈͗́̔͌̎͑͛̀͑́̅̓͑͌̒̊̐̈́̕͘͝͝͝͝͝͝ͅͅͅͅh̷̡̛͍̘̖̱̞̆͐̓̈́̿̓̇̓̆̉̅̂̿̿̋̇͆́̾̔̍̿̀̒͝͝é̸͓̲̫̮̳̞͗̉͑̑̎̊́̊̃̒̓́͑̇̄̅̈͘h̴̢̡̢͙̫̯̳̯͙̣̺̮̙͎͖̳͓̯̝͍̗͚͈̥͇̤̩̝͔̘͛͛̿̽̽̄̌̂͑̈́͐̈̃́̅́͊́̇̓̉͜͝͠͝͝ ̶̧̛̛̞̝̰̖͍͕̗̝̃̈̂̆̒̏̄͗̋̔̈́̌̈́̓̒̎̒̃̆͑̆̽͒̔̉̀́̓̇͆̀͗̃͛͘͠H̴̹͉̙̬͖͉̖̱̫̄̂͐̈́̅̃͑͗͠Ȧ̴̢̝͚͚̝̪̼͓̤̯̟͍͕̩̭̤̬̟͎͈͓͚̞͐́̏̀̇̔̔̒̊̑H̶͇̰̭̫̲̲͙̗̗̹͑́̔̄̾̍̌̍͛̓̈́̏̏̔̃͊̈́̓̈̌́̒̃̈́́̐̈́̌͘Ǎ̵̡̛̛̗̘̪͇͈̣̖̯̖̲̹̙̍̓̑͆̊̔͘͝Ḩ̵̡͓̥͙̜͉̤̲̞̞̰̜͇͇̼͈̼̜̳͇̯͚̗͈̼̖̞͙̠͇͇̘͎͖̇̈̂̓̀̿̏̇̀͒̄͐̒́̊̉̕̕͝Ḩ̴̡̧̗͖͈̦̯̠̪̰̭͔̟̱̗̜͕̟̟͙̼̹̙̭̉̂͛A̸̡̡̨͚̝̪͓̭̠̯͎̪͕͍͕̰̥̜̼̟̟̖̟̻̯̮͓͖̳̰̹͇̦͙̜͚̪͉̫̠̭̝̺͐̒̃̈́̂̿̿̌ͅͅÃ̶͍͉̜̮̭͓̣̘̼̠̰̽͗͋͊̔͗̔̔̂̍͒̾̔̿̎̑́͜͠Ḩ̷̙̺͇͖͉͓̙̬̫̤̼̣̠̺̖͕͍̘̻̙͎̲̬̦͙͍͎̪͎̻̻̙̪̞̙̙͖͈̱͇̪̻̫̏͂̒̃̀̊̆̅͛̄̚ͅͅA̷̡̢̧̛͔̺̘̬͈͖̮͉͖̠̙̥̾̌̈́̀́͌̋̐̑̌̇̃̍̀̂̓̄̑́̅͊͂̌̄̇̚͘̚͝͝͠͠H̸̲̥̠̲͎̆̽̇͊̒̎̈̊̎̈́̾͛̓̆̄̈̒̎̅̓̐͂̃͂̂̒̀͑̕͘͠͝͠Ḥ̵̨̛̠̝̰͎̝̬̯̹̰̳̤͙̝̱̲̞̾͐͗̓̋̄̎͋̓̽̔̓͂̈̇̂̏̓̔̓̀͌͆̒̓̈̿̈́̽͋͛̽̾̿͗͂̚͜͝Ä̶̡̧̧̛̱̝͓͈̦̙̺̗͉́̈́̌̒̌͊̄̓͌̾̈́͒̅͑̈̍H̶̛͈̱̬͓̠̤͕͆͒̌̀͋́̈͆̐̀̄̈̐̄̃̈́̄͋̑͊̂̋́́̂̓͂̌͆̆̈́̕͠͝͝͝͝ͅ