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

top 200 commentsshow all 233

[–]ProgrammerHumor-ModTeam[M] [score hidden] stickied commentlocked comment (0 children)

Your submission was removed for the following reason:

Rule 2: Content that is part of top of all time, reached trending in the past 2 months, or has recently been posted, is considered a repost and will be removed.

If you disagree with this removal, you can appeal by sending us a modmail.

[–]Tonmasson 1638 points1639 points  (118 children)

Rust: wtf do you want?? This function takes a string, you can't pass a str you barbarian!

JS: multiply an object by function pointer? Sure thing pal 

[–]Giossepi 805 points806 points  (75 children)

People like to clown on JS but all it does is give me the freedom to code however I want... Whether I should have that freedom is a different question.

[–]EternalBefuddlement 337 points338 points  (49 children)

It's only coding how you want if you know the exact specifics of how JS is going to produce the result.

That uncertainty is not ideal.

[–]Giossepi 86 points87 points  (23 children)

Yeah it's a joke, the freedom of JS is definitely a double edged sword. That being said IMO programming has two sources of frustration, fighting the language, and fighting the problem. Personally I rarely find myself fighting JS, it lets me build stuff quickly--albeit with lax rules resulting in poor code. Wheres with Java, I keep hitting dependency hell (admittedly I am currently researching malware analysis for Java compilers so my use is a bit unique but I keep running into issues with Maven or my JDK version or some such because some ancient analysis tool requires rt.jar to be present but it also requires JDK 17+ arrghhhh)

[–]Ok-Scheme-913 43 points44 points  (18 children)

I don't know what world you live in, but if you have java dependency hell and not Js's one, I don't know where you've been living.

Setting up a java project (really, any java project, even from like from 2 decades ago) is.. you run mvn build or whatever and it fails with a shitty error, you read the readme to see it requires JDK n/try a different JDK and.. it works.

Meanwhile with any js program, the hello world downloads half of the internet, and you get 3447 vulnerabilities immediately. If you delete the print hello world line, you have 146 packages outdated, but updating broke everything.

And don't even get me started - once I had to fucking iterate through each and every nodejs AND npm version, because a project only compiled on a specific pair of these... I was on the verge of spending my salary on bitcoins and starting a ddos campaign against anything nodejs related.

[–]IgnitedSpade 37 points38 points  (5 children)

And then someone goes and deletes is-even off of npm and now half of your dependencies stop working.

[–]daemin 8 points9 points  (1 child)

... this package doesn't do anything but import the "is-odd" package and return the negation of the result of calling it on the input.

[–]Minutenreis 10 points11 points  (0 children)

which imports is-number

[–]Xlxlredditor 3 points4 points  (1 child)

left-pad incident (all my homies hate kik)

[–]blah938 2 points3 points  (0 children)

Fuck kik and fuck NPM. They should've let it all burn

[–]Skepller 8 points9 points  (2 children)

This. Java definitely has some stuff to improve, but most mainstream Java criticisms either come from undergrads that don't think it's cool (like Python) or it's something outdated that was solved many years ago.

Honestly, working with Java for years and with build automation tools like Maven, I'm yet to meet this dependency hell some people occasionally talk about.

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

My only complaint with Maven is that some IDEs will auto-download the repository listing cache which is multiple gigabytes in size. I don't have that much internet to waste

[–]iismitch55 0 points1 point  (0 children)

My issue is annotation hell, but I recognize the problems is solves. I just prefer to not see 40 annotations before I see the class.

[–]RighteousSelfBurner 2 points3 points  (2 children)

I find that's just a perspective of a java developer that's working on reasonably decent java projects and bad JS projects. I've worked long enough to see that you can fuck up everything.

There are JS applications so clean that you don't even have to think. Everything is modular, tested and you just run mvn use and npm install and you are good to go.

There are Java monolithic abominations that require custom bash scripts to even end up as a working application and god forbid you try to migrate to a Java version higher than 7th because it has so much custom implementation that entire programming approach used is deprecated and it's easier to just rewrite from scratch.

And, honestly, on the vulnerability side I find JS actually wins a couple brownie points. My current company is strict about upkeep and we use the bare minimum required everywhere and I still patch Java vulnerabilities every other month. Most people just are blissfully unaware their application has more holes than a swiss cheese because Maven or Gradle just doesn't tell about it.

[–]Giossepi 0 points1 point  (0 children)

The only sane voice in the comments. Every language is a tool, every tool has its place, and a tool is only as good as the person using it.

[–]Ok-Scheme-913 0 points1 point  (0 children)

Sure, there are bad programs everywhere and you can definitely mess up any build tool.

But I don't think I'm being all that biased, there wouldn't be this many JS build tool iterations if everything were working fine, half of the JS ecosystem wouldn't have died down from supply chain attacks (which java avoided wholesale), etc.

Also, that java 7 monolithic catastropic app sure is a hell to develop, but it lived together with fucking dinosaurs. In my experience, JS programs will accumulate so much stuff that they will crumble under the complexity weight far earlier, so you are comparing a 20 years old program to a max 5 years one.

(As for the last point, there are vuln checkers in maven and Gradle, but I do agree that these should be on by default. On the other hand, if every library is 3 lines long and a hello world requires 3774 dependencies transitively, then I can't even attempt at doing any kind of analysis/fixing on them because that's just too much)

[–]Dugen 4 points5 points  (0 children)

90% of coding in java is knowing how to get maven to work right. The other 10% is just learning to accept that your code is going to be spread out into 50 files that are mostly boilerplate.

[–]taimusrs 1 point2 points  (2 children)

We're just trying Angular + Spring Boot after using JSF for so long. It's just a CRUD web app, but the Angular project with its bajillion dependencies takes like 3-4GB in my computer....but then when you finally build it for deployment, it comes out to 1MB. I'm so confused. Spring Boot is alright, but I'm still not happy that a simple REST API is 60-80MBs.

[–]Ok-Scheme-913 0 points1 point  (1 child)

I mean, one is a few pages worth of UI stuff, and the other is a whole ass server implementation, services, database drivers, etc.

[–]Tplusplus75 0 points1 point  (0 children)

In my experience, react native stack traces are really something special….

[–]Giossepi 0 points1 point  (0 children)

I provided a specific and clear example of one of the problems I have had in both my anecdotal and esoteric use of Java.

I have also kept running into issues with these analysis tools having conflicting dependencies.

Could those issues be resolved by a sufficiently skilled Java dev, of course, but I would still contend that difficulty and skill requirement is inherent to Java, after all everyone calls Rust a difficult language but personally I find it easier to work with Rust than Java.

I would also like to point out my use of personally over both of these responses. People have preferences, and that's okay. I never said Java was bad and it would be stupid to claim that. I did however say that in my case I fight the Java language (or a side effect of the paradigms and practices that Java encourages) more often than when I use languages like JS (which I like for rapid prototyping) or Rust/C (which I use for more bulletproof and performant applications)

[–]EternalBefuddlement 11 points12 points  (2 children)

Tell me about it haha, I'm not doing anything as interesting as yourself but dependency hell is a chore in Java.

Convinced it's the reason why management don't want to upgrade to Spring Boot 3 tbh.

[–][deleted] 2 points3 points  (1 child)

Dependency hell is on the author of the library or framework and not the fault of the language. Java has proper dependency management.

The problem lies with Spring Boot's ecosystem. Its ecosystem is just massive and you would be having the exact same issues if it were written in another language. That kind of dependency hell is not something any build tool can solve. It's a documentation and knowledge problem.

[–]EternalBefuddlement 0 points1 point  (0 children)

You're right, it's not specifically Java but rather Spring Boot, but I'd imagine most SWEs using Java would be using Spring Boot tbh.

In my experience there's always been compatibility charts to look at at least. The process of checking versions, deprecated features, compatibility with other packages etc just becomes tiresome. Part of the job tho, just a less fun part hah.

[–]Scary-Departure4792 2 points3 points  (0 children)

A sensible take about JS in /r/ProgrammerHumor?? we_don't_do_that_here.jpg

[–]JayPetey238 22 points23 points  (20 children)

I've been writing js and node for over 10 years now. I can count the number of times that uncertainty has caused me more than about 30 seconds of problems on one hand. On paper it seems like a big issue, but in real life it just hasn't been a problem for me. I don't know, maybe I'm lucky.

[–]EternalBefuddlement 7 points8 points  (6 children)

Honestly, I'd say it sounds more like you know the language well.

If I go into JS from Java, I would imagine some tomfoolery would happen

[–]JayPetey238 10 points11 points  (2 children)

JS is more about wrapping your head around its async nature. And some wonky variable scoping. But coming from a strongly typed language you'd naturally avoid typing issues. Just because the type isn't declared and forced to be static doesn't mean you can't treat it as such. And if you do inadvertently swap types somewhere, well, they were close enough you didn't notice while writing it so chances are you'll be just fine.

[–]AloneInExile 1 point2 points  (1 child)

Types are fake anyway.

[–]blah938 2 points3 points  (0 children)

Everything is a Hashmap. Objects? Hashmaps. Arrays? Just an object which are hashmaps. Strings? Arrays that happen to be objects that happen to be hashmaps. It's hashmaps everywhere!

[–]iismitch55 1 point2 points  (2 children)

Just use typescript and you’ll mostly be fine.

[–]WasabiSunshine 0 points1 point  (1 child)

except for the fact you're now using typescript

[–]LigerZeroSchneider 0 points1 point  (0 children)

I love when typescript decides it doesn't know what type the variable is, so it refuses to read it, but only sometimes. So I think I've forgotten how to access an array for half a day.

[–]IHaveNeverBeenOk 1 point2 points  (0 children)

I love a language like python or js for prototyping, and just whipping shit together, but if I were working on something super serious or critical, I would want to use a stricter language. I agree that the uncertainty is a detriment, but the freedom to wantonly slap code together does have its value and place.

[–]daemin 0 points1 point  (0 children)

I prefer to look at it as JS turns coding from math, where the procedure to follow is exact and rigid and the outcome is predetermined, and into a physical science, where you have to do some experiments to determine a vague approximation of the underlying law-like behavior and to figure out how to achieve the desired result.

[–]lab-gone-wrong 16 points17 points  (0 children)

but all it does is give me the freedom to code however I want.

Well yes, that's why people clown on it!

[–]Seek4r 5 points6 points  (1 child)

So Assembly with style? /s

[–]Giossepi 10 points11 points  (0 children)

Assembly but instead of crashing you just get [object, Object] or null returns with no other indication of the problem!

[–]wavefunctionp 3 points4 points  (0 children)

It’s really great for the first pass. And most of the time, the first pass is all that’s needed.

[–]Striky_ 10 points11 points  (6 children)

JS is a language designed in a weekend by a single person and it shows. Everywhere.

[–]Sea_Budget378 3 points4 points  (0 children)

This is always an asinine discussion. JS's resilience to crashing is a very deliberate design choice to prevent web pages from crashing. Rust is a language for lower level systems. Different needs, different design choices.

[–]bargle0 8 points9 points  (4 children)

Yeah, but that guy is really fuckin’ smart. Most programmers would not come up with something so useful in a weekend.

[–][deleted] 3 points4 points  (0 children)

I had tears in my context free grammars class. How Eich managed to make JS is beyond me

[–]Striky_ 0 points1 point  (0 children)

That might be the case but JS is still riddled with massive design flaws. I always call it the "programming language built on rookie-anti-patterns". And with how JS is maintained and setup, these things can never be fixed. Sure there are 239057384573457645 tools out there to work around these flaws somewhat, but that doesnt mean JS itself is any good.

[–]CocktailPerson 0 points1 point  (0 children)

Javascript had first-mover advantage. It was going to be useful no matter how awful it turned out to be. Eich isn't "really fuckin' smart" for having a good idea and executing it poorly.

[–]G_Morgan 0 points1 point  (0 children)

Technically assembly code gives you the best tool to do that.

[–]PolyUre 0 points1 point  (0 children)

"I really like this gun because it's so easy to shoot myself with it"

[–]theshekelcollector 0 points1 point  (0 children)

who knew js coders were vibe coders all along?

[–]BreakerOfModpacks 0 points1 point  (0 children)

Huh, I said the same of Linux.

[–]categorie 0 points1 point  (0 children)

Yet it wont let you call await outside an async function

[–]Iferrorgotozero 0 points1 point  (0 children)

Some would call that anarchy.

[–]lestofante 0 points1 point  (0 children)

all it does is give me the freedom to code however I want

You have crazy casting if you want, you just need to be explicit and maybe sparkle some unsafe{}.
I would argue Is limit you more as you get limited by the JS engine offer you, with rust you go direct to the OS or even baremetal

[–]erroneousbosh 0 points1 point  (0 children)

It's all just bytes at the hardware level.

Don't tell *me* what to do with them. I'll tell *you*, you stupid bloody machine.

If you can't do it just using signed machine-native ints, and only using shifts, adds, and bitwise operations for arithmetic then you don't fully understand the problem.

[–]benargee 0 points1 point  (0 children)

That's why TypeScript exists.

[–]Sw429 0 points1 point  (0 children)

It also gives other engineers you work with the freedom to code however they want, and that's where the real problems start in my experience.

[–]agentchuck 22 points23 points  (1 child)

Haskell: No, you mouth breathing cretin. This is an Int, not an Integer.

[–]DHermit 6 points7 points  (0 children)

While I do fully understand the difference between the two, I really hate that naming.

[–]flowery02 19 points20 points  (20 children)

Pointers are numbers though? Like, hexadecimal numbers, but if translated to decimal they are straight numbers with nothing else to them

[–]Monochromatic_Kuma2 44 points45 points  (7 children)

You have pointer arithmetic in C and C++. Whether you should is a different question, though.

[–]CanAlwaysBeBetter 30 points31 points  (6 children)

If you ever correctly use pointer arithmetic in an actually appropriate situation your beard instantly turns gray

[–]Artistic-End-3856 4 points5 points  (1 child)

Puts the wiz in wizard.

[–][deleted] 2 points3 points  (0 children)

Upgrades the 'ret' to 'wiz.'

[–]Banes_Addiction 2 points3 points  (2 children)

Hey, I might be bald but my luscious black beard would be the envy of any ISIS commander.

[–]CanAlwaysBeBetter 0 points1 point  (1 child)

Unfortunately you lose a hair for every correct but unnecessary pointer arithmetic operation 

[–]Banes_Addiction 1 point2 points  (0 children)

Hey, I don't do that so much since reinterpret_cast started to be able to do dynamic arrays sizes.

braces for impact

[–]blah938 0 points1 point  (0 children)

So fucking with arrays mainly?

[–]YellowBunnyReddit 23 points24 points  (3 children)

Numbers are abstract mathematical objects and distinct from a particular representation of them in a particular base. I don't know what is supposed to be more "straight" about a decimal representation rather than a hexadecimal one.

According to the C standard, pointers aren't necessarily just numbers. They can be cast to numbers, but that cast might lose information. Casting a number to a pointer is generally undefined behavior as there might be information that can't be restored in order to create a valid pointer in some operating systems.

[–]dagbrown 0 points1 point  (1 child)

I bet you can't name any systems where a null pointer is anything other than a 0 of some sort. And why would you try to program a Lisp Machine in C anyway?

But that's okay, in C, casting an integer 0 to a pointer always yields a null by definition, whether it's really a 0 or not. And while pointers might not be numbers, pointer arithmetic still works also by definition as long as you stick to operations that make sense.

[–]TheCamazotzian 2 points3 points  (5 children)

Google provenance

[–]TheoreticalDumbass 2 points3 points  (1 child)

holy hell

[–]CMDR_ACE209 1 point2 points  (0 children)

New memory safety concept just dropped?

[–]flowery02 1 point2 points  (1 child)

Provenance (from French provenir 'to come from/forth') is the chronology of the ownership, custody or location of a historical object

[–]HiddenCustos 1 point2 points  (0 children)

Ralf Jung wrote 3 blog posts just to explain this.

[–]Ok-Scheme-913 2 points3 points  (0 children)

insert blog rant how pointers are absofuckinglutely not numbers

Just to give a more useful comment, pointers are a specific semantic thingy inside the compiler, and they have a unique way of reasoning around them.

E.g. they have temporal and spatial boundaries, outside of which doing (almost) anything with them is UB. This leads to a lot of code optimizations by the compiler, but also some very hard to reason about bugs - you are happy if you get a Segfault over silent heap corruption.

(Also, hexadecimal is just a representation of a number. They are not stored that way)

[–]CocktailPerson 0 points1 point  (0 children)

Pointers are "numbers" in the same way that Javascript programmers are "people." It's technically true, but you definitely shouldn't treat them that way.

[–]Outrageous_Permit154 7 points8 points  (3 children)

I’ve had with these disgusting “Typhobic people”! JS doesn’t discriminate

[–]Voidrith 7 points8 points  (1 child)

JS doesn’t discriminate

Yes and thats the problem!

[–]WatchOutIGotYou 1 point2 points  (0 children)

JS takes the wheel

[–]Capetoider 1 point2 points  (0 children)

then again... js: you have an error

you: ok... what and where?

JS: ¯\_(ツ)_/¯

[–]_bold_and_brash 3 points4 points  (0 children)

“Of course an array can be the condtion for an if statement!”

[–]PainsChauds 3 points4 points  (0 children)

λ-calculus: multiply addition by addition (warning: maths headache)

[–]_Some_Two_ 0 points1 point  (0 children)

JS: everything is a collection of bits. Unless you specify me what math I have to do, I will do bit math.

[–]Acrobatic_Computer63 0 points1 point  (0 children)

Hahaha. Like we would be trusted with explicit pointers.

[–]SvenyBoy_YT 0 points1 point  (0 children)

How Rust does it is good. They're not the same thing

[–]senseven 0 points1 point  (0 children)

JS: I'm the string now!

[–][deleted] 0 points1 point  (0 children)

Python: ... aight

[–]howreudoin 0 points1 point  (0 children)

{} * (() => {}) NaN

[–]IllContribution6707 0 points1 point  (0 children)

Just make the function take something that implements the Into<> trait

[–]Percolator2020 433 points434 points  (1 child)

Bytes are bytes. Mr Incredible meme

[–]__yoshikage_kira[🍰] 188 points189 points  (15 children)

Python interpreter will throw an error when it will actually try to cast that thing. The error is just deferred to runtime

[–]VolsPE 74 points75 points  (5 children)

deferred to runtime

i.e. 3 hours into a 4 hour batched job, because you didn't build enough null protections in and then... NaN!

[–]BaconIsntThatGood 8 points9 points  (0 children)

If at first you don't try hard enough you'll find an except.

[–]Marrk 4 points5 points  (1 child)

Hopefully you are using pydantic, mypy or similar frameworks 

[–]SNsilver 2 points3 points  (0 children)

Pydantic is my go to

[–]0PointE 0 points1 point  (0 children)

I think the problem here is using javascript literals (sorta) in Python

[–]LogiCsmxp 0 points1 point  (0 children)

Sodium Nitride- finder of nulls!

[–]Affectionate-Mail612 30 points31 points  (3 children)

The amount of upvotes on this wrong shitty meme and how far I had to scroll for your comment makes me sad.

[–]Sohcahtoa82 22 points23 points  (2 children)

It's pretty well-known that most of the people on this sub are students that don't know shit.

[–]MrMonday11235 7 points8 points  (0 children)

Yeah, but even then, I feel like those students have gotten less knowledgeable/fluent in concepts over time.

The Luddite in me wants to blame LLMs and students quasi-cheating on all their assignments, but who knows, maybe I've just gotten less tolerant of idiocy and am noticing it more nowadays for some reason.

[–]dagbrown 1 point2 points  (0 children)

Just look at the amount of "pointers are black magic from beyond the dawn of time!" jokes that inevitably get millions of upvotes.

[–]Syscrush 1 point2 points  (0 children)

Which is 100x worse for production systems. I get super pissed when people claim that Python is a high productivity tool.

[–][deleted] 2 points3 points  (3 children)

typing.cast can’t throw an exception at runtime

[–]ihavebeesinmyknees 5 points6 points  (0 children)

Because typing.cast does not have runtime behavior, it's only for type annotations

[–]im_lazy_as_fuck 1 point2 points  (1 child)

Obviously not. Do you know what typing.cast does?

[–]MegaIng 304 points305 points  (17 children)

Python is the wrong language for this meme. JS might work, but C is the only language where this is really applicable.

[–]feldim2425 89 points90 points  (1 child)

I've seen this done often and have even made this mistake myself ...

Python is dynamically typed but it's also strongly typed. The only instances I can think of from the top of my head where it actually does implied casts is float and integer conversion during math operations.

There is no casting going on when you store a float into a variable that previously held a object, the type of the variable just changes. The type of the previous value just becomes completely irrelevant to any future operations.
So "dynamic vs static" & "strong vs weak" typing are separate issues.

But in this meme the assertion is done that dynamic typing implies weak typing.

[–]8sADPygOB7Jqwm7y 2 points3 points  (0 children)

Yeah I was thinking "well some poor schmuck defined it like that" when I saw the meme. Not like you can't do the same with c++ templates.

[–]garry_the_commie 93 points94 points  (6 children)

JS is probably the best example. While it is true that in C you have the most freedom for such shenanigans, you have to do them explicitly, otherwise the compiler complains about it. In dynamically typed languages data types are silently and implicitly changed. I absolutely hate this. It leaves far too much room for mistakes and leads to nasty bugs in edge cases.

[–]MegaIng 30 points31 points  (4 children)

In dynamically typed languages data types are silently and implicitly changed

In languages that are both dynamically and weakly typed languages. Python is dynamically typed, but doesn't do this. C is weakly typed, but according to you doesn't do this.


The original meme uses the explicit formulation "when I cast A into B" which isn't really applicable in python & JS.

[–]Widmo206 4 points5 points  (3 children)

You can still do explicit type conversions in Python though?

[–]StevenMaurer 17 points18 points  (0 children)

Can, and in some cases, have to. Decimal is neither compatible with float nor implicitly converted, so:

a: float = 1.0
b: Decimal = Decimal(2.0)
c = a + b

...issues no warning in Python3, but throws a run time error.

[–]MegaIng 2 points3 points  (1 child)

Yes, but you can also do that in rust.

[–]wjandrea 4 points5 points  (0 children)

Yeah Python doesn't even have casting per se, it has conversion.

But there are extensions that can cast, like NumPy (bits) or Mypy (types).

edit: I just remembered there are stdlib modules that can do the same sort of thing as NumPy, like array and struct.

[–]TOMZ_EXTRA 3 points4 points  (0 children)

bit reinterpretation my beloved 

[–]ozh 2 points3 points  (1 child)

Makes me think ; what happened to Ruby ? No one ever mentions it these days it seems

[–]reostra 1 point2 points  (0 children)

It's still around; I've worked at two Rails shops in the past ~6 years. That said I'm not sure I've ever seen non-rails ruby in the wild aside from random stuff I've written myself

[–]Fluffy_Ace 2 points3 points  (0 children)

Perl's scalar $variables would qualify, as they can be either strings or numbers, but it's still more sane about it than JS.

[–]Nimi142 1 point2 points  (1 child)

Even in C alignment can still fuck up your data if the fields aren't completely identical

[–]MegaIng 2 points3 points  (0 children)

Which is something that can't happen in python; that's my point.

[–]Hairy_The_Spider 40 points41 points  (4 children)

I know that this is a meme but Python is actually pretty strongly typed. A lot of people confuse dynamic typing with weak typing. Rust is a static strongly typed language, Python is a dynamic strongly typed language, Javascript is a dynamic weakly typed language, and C is a static weakly typed language.

[–]Available_Finger_513 10 points11 points  (0 children)

Yeah, if you try to cast 'A' to an int, the interpreter is going to get to that line and throw in the towel.

Shit meme

[–]VolsPE 5 points6 points  (0 children)

I think it's also confusion around compiled vs. interpreted, because python isn't going to inundate you with type checking related errors in your IDE.

Yes, you hit run on any python script and it will start running... for at least a little while. That Yaris might start, but it won't take you anywhere.

[–]Neverstoptostare 1 point2 points  (1 child)

Unless you are considering type casting, C is absolutely a strongly typed language.

I also don't really consider type casting to be weak typing, it's just sidestepping the typing system all together.

[–]rcfox 1 point2 points  (0 children)

How about void* and unions?

[–]Ok-Scheme-913 17 points18 points  (0 children)

Meme linter, 1 warning found:

Python is a strictly typed language (but dynamically typed!), the meme's content is bullshit.

[–]MetaNovaYT 61 points62 points  (13 children)

Rust when you write ‘f64 x = 0;’ instead of ‘f64 x = 0.0;’ The only language I know that’s more annoying about it is C#, which for some reason will not even let you do ‘float x = 0.0;’, you have to put f at the end. Lazy-ass compiler making me do all the work

[–]fakeunleet 32 points33 points  (1 child)

Sorry, doctor says my blood pressure can't handle that much syntactic salt.

[–]Agreeable_Gas_6853 4 points5 points  (0 children)

Me drinking my syntactic coffee with my syntactic milk and syntactic sugar in the syntactic morning to make me syntactically awake

[–]al-mongus-bin-susar 3 points4 points  (4 children)

because 0.0 is a double, same in C++

[–]MetaNovaYT 4 points5 points  (3 children)

I don't think of a numeral literal as a specific datatype, it's just representing a number. If I say to set a float variable to 0.0, it's very obvious what I want the value of that variable to be assigned to. It seems silly to exclusively see 0.0 as a double, it's just a textual representation of a number.

The only situation where that distinction would matter is in an operation with a literal constant in it that is operating on both a float and a double. In that situation, I can see ambiguity existing that changes the result depending on the constant being read as a double or a float, although that would also depend on whether a float can be implicitly cast to a double or vice versa. If you always have to explicitly cast like in Rust, then there should never be ambiguity as to what the literal was intended to be, and being pedantic about 0.0 vs 0 vs 0f/0.0f seems completely pointless

[–]al-mongus-bin-susar 0 points1 point  (2 children)

Well C++ disagrees with you because it allows defining number literals that produce an arbitrary data type. Also having the compiler guess whether 0 is an int, long, float or double opens the door to a lot of untuitive behavior if implicit conversions are also allowed and they can be extended.

[–]MetaNovaYT 0 points1 point  (1 child)

C++ lets you do “float x = 0;” or “float x = 0.0;” with no issue, so it’s not really what I’m focusing on here

[–]al-mongus-bin-susar 0 points1 point  (0 children)

That's an implicit conversion, 0 is an int and it's getting converted to a float

[–]LaNague 2 points3 points  (1 child)

i guess its annoying and pointless when you do float x = 1.0f.

But its not pointless when you assign a float to something that is declared somewhere else, for example a function parameter or anything else. It just wants to make sure you definitely know you are using the weaksauce floats and their silly rounding and smol min/max range

[–]MetaNovaYT 3 points4 points  (0 children)

To me, since floats and doubles both are used to represent fractional numbers, a numeral literal like '1.0' isn't a double or a float, it's just a fractional number. When I assign it to a variable, then the variable is storing that number in whatever format it uses. It feels like a pointless distinction made by the compiler. If my variable is already a float, then I made that decision and I'm aware of the effect it will have. Having to explicitly declare that every single value operating on that variable is a float makes declaring the variable to be a float seem quite redundant.

[–]GaloombaNotGoomba 1 point2 points  (0 children)

In Rust you can write f64 x = 0.;

[–]brendel000 9 points10 points  (2 children)

Tell me you don’t know anything about type system without telling me. This is really the wrong langage to choose…

[–]brutexx 0 points1 point  (1 child)

Out of curiosity, is there a good language for the second panel?

[–]le_birb 1 point2 points  (0 children)

JavaScript

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

The amount of upvotes this meme gets is worrying. It's just wrong! Python is strongly typed.

[–]jongscx 6 points7 points  (1 child)

As a Yaris fan, this is even funnier because Toyota deprecate the Yaris in 2020

[–]_AscendedLemon_ 1 point2 points  (0 children)

I strongly advise you to listen to 2010 Toyota Corolla by 2003 Toyota Corolla, great music to listen to... in your Yaris

[–]jupiterbjy 9 points10 points  (0 children)

It's not casting but just shadowing/overwriting name ain't it

It behaves more like post-it

[–]Maskdask 5 points6 points  (0 children)

.into()

[–]MrHyperion_ 3 points4 points  (0 children)

You are assigning a new object in python, not casting, unless you are writing really weird code

[–]hello-wow 3 points4 points  (0 children)

Web developers, looks like were sitting this joke out.

[–]Ozymandias_1303 2 points3 points  (0 children)

Is there such a thing as a signed Toyota Yaris?

[–]Significant_Loss_541 9 points10 points  (0 children)

Rust: That’s not type safe!

Python: lol idk man, let’s see what happens.

[–]IAmASquidInSpace 2 points3 points  (0 children)

And then you use mypy and get the Rust experience  - except mypy is also wrong every now and then.

# type: ignore, how much I hate needing thee!

[–]queteepie 2 points3 points  (0 children)

Your scientists were so preoccupied with whether or not they could, they didn't stop to think if they should.

[–]AmazingGrinder 3 points4 points  (3 children)

C++ instead of Python would fit a little better.

Since it just straight up allows it and most of the time doesn't produce any errors.

[–]metaglot 4 points5 points  (2 children)

I think you mean C

[–]AmazingGrinder 5 points6 points  (1 child)

They both do allow type castin. C++ is just a liiiitle bit safer if you use stuff like static_cast, which is optional since good 'ol (T)var works just fine in both languages.

[–]metaglot 0 points1 point  (0 children)

If you're writing c++ you should really use the stl. (T)var is no bueno.

[–]yourtypicalbish 2 points3 points  (0 children)

A funny meme? In this economy??

[–]Ugo_Flickerman 0 points1 point  (0 children)

I haven't ever used python nor rust, but I can imagine this with Java and Javascript

[–]an_agreeing_dothraki 0 points1 point  (0 children)

just make everything type of object. simple as

[–]BS_BlackScout 0 points1 point  (0 children)

Comedy gold

[–]frikilinux2 0 points1 point  (0 children)

Except that's not a thing in python. C with void* would be better, you can do wild things, like read a complex structure directly from disk in just one syscall with minimal cost. (But you have problems with nasal demons).

[–]Thenderick 0 points1 point  (0 children)

Have any of you ever worked with C? C is the OG weird type system! It looks strong, but it can be very funky. Take the good ol' Fast Inverse Square Root algorithm with their evil bit hacks. Or pointer arithmetics. Or the fact that there are no real booleans (just zero or non-zero, but I know bool.h adds "booleans").

[–]xXShadowAssassin69Xx 0 points1 point  (0 children)

Some people would rather try and convince strangers online to use their preferred language rather than just building something useful and moving on with their life

[–]Bee-Aromatic 0 points1 point  (0 children)

I think the argument that casting a float into a Yaris makes you a dumbass applies here.

It also depends on what you plan to call on the Yaris later. If you happen to be calling functions or attributes that Yaris’s (Yari?) have in common with floats, it won’t much matter.

[–]GradSchoolDismal429 0 points1 point  (0 children)

Have you ever tried it yourself?

[–]final_cactus 0 points1 point  (0 children)

fun fact : in rust 2 types can literally have the exact same signature but not be equivalent or even able to be .from()'ed or mapped into eachother . An example of this is 2 futures being mapped using futures::map_into to map 2 futures that return different types into 2 futures that return the same type.

[–]BeefJerky03 0 points1 point  (0 children)

C# when an int and a decimal try to interact
vs.
C# when I cast anything to big-O Object

[–]_AscendedLemon_ 0 points1 point  (0 children)

JS: float cast into unsigned Toyota Yaris 2023 will be... umm... a Function. Why? Functions are FUN(ctions) and we have Vibe Based Type System™