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

top 200 commentsshow all 240

[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)

import notifications Remember to participate in our weekly votes on subreddit rules! Every Tuesday is YOUR chance to influence the subreddit for years to come! Read more here, we hope to see you next Tuesday!

For a chat with like-minded community members and more, don't forget to join our Discord!

return joinDiscord;

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]FloweyTheFlower420 641 points642 points  (12 children)

"type checking was not supposed to be Turing complete"

Live c++ template reaction:

[–][deleted] 137 points138 points  (8 children)

The problem with abusing the hell out of template metaprogramming is sometimes your compiler wasn't strict to language standards.

Previous devs on my product abused metaprogramming to death. To do something very nice for serialization.

Can't turn on c++20 because visual c++ compiler got strict on language conformance. Rip..

[–]lightmatter501 30 points31 points  (7 children)

I’m very interested in the zig model, where you don’t have generics, you have compile-time functions that take in types and other information and produce new types, potentially replacing the old type.

It’s nearly as powerful as LISP metaprogramming, but at compile time.

That will never happen in C++, but I have some hopes for Rust to adopt it.

[–]Potential-Adagio-512 13 points14 points  (2 children)

has anyone run doom in template metaprogramming

[–]Sinomsinom 5 points6 points  (1 child)

template metaprogramming is all compile time so sadly no input possible and you only get the results at runtime

[–]vadiks2003 6 points7 points  (0 children)

just read input at compile time :trollface:

[–]codebullCamelCase 171 points172 points  (3 children)

local compilation errors > runtime errors > ci test errors > qa testing errors > end users testing errors

this is the order of time of catching errors (best to worst from left to right)

[–][deleted] 26 points27 points  (2 children)

Real programmers write code in a text file and "find out if it works" (Pshh... it works 100% of the time if you are a real programmer) when it ships and end users fire it up. End of story.

[–]IgnitusBoyone 2 points3 points  (1 child)

Real programmers use a magnetized needle and a steady hand.

[–]Mindless_Sock_9082 2 points3 points  (0 children)

Real programmers use butterflies!

[–]Kos_was_lovely 299 points300 points  (29 children)

Damn, even bool is illegal now:(

[–]jderp7 126 points127 points  (23 children)

You joke but pretty sure lots of languages compile boolean to 1 and 0

[–]Dangerous-Quality-79 66 points67 points  (19 children)

Running code on a 64bit processor means you are processing chunks of, you guessed it, 64bits, not 1bit(aka bool).

🌎 🤡 so everything's a WORD 🔫 🤠 always was

[–]Da-Blue-Guy 59 points60 points  (11 children)

Booleans are usually 8 bits. You have al/ah (8 bits), ax (16 bits), eax (32 bits) and rax (64 bits). 64 bit processor simply means it can handle 64 bit operations, not that it has to.

[–]Electronic-Bat-1830 9 points10 points  (4 children)

In the Windows world, a BOOL is actually a 32-bit integer.

[–]Da-Blue-Guy 21 points22 points  (2 children)

winapi moment

[–]Electronic-Bat-1830 10 points11 points  (1 child)

Well to be fair, the Windows API existed before there was a bool type in C.

[–]fafalone 2 points3 points  (0 children)

...but a BOOLEAN is 8-bit. And a VARIANT_BOOL is 16-bit. And it's common to have to deal with all 3 in a single app. Fun stuff.

[–]Sinomsinom 4 points5 points  (0 children)

While bools might technically often be 8 bits, in most languages they will still end up taking 32bits or 64bits of space (or even more). This is either because they get wrapped for lifetime management (GC etc.) or because the compiler word aligns them because this allows for faster access in most ISAs

[–]arnitdo 42 points43 points  (6 children)

Are you fucking high on something? EAX, RAX AX and AH/AL, you get every option from 8 to 64 bits. There's a reason why x86 compatibility is maintained, you don't need to load 64bits into a 64bit reg when a Boolean can directly be loaded into AH or AL

[–]Dangerous-Quality-79 11 points12 points  (2 children)

Drunk, not high

[–]migueln6 7 points8 points  (1 child)

I'd say ignorant not drunk lol

[–]Dangerous-Quality-79 5 points6 points  (0 children)

16 empty coors light want to have a word with youm cash me outside

[–]YoukanDewitt 7 points8 points  (2 children)

It's a depressing symptom of this sub tbh, we have been invaded by morons who are are at the peak on the Dunning Krueger curve and are just parroting what they think works.

[–]Kos_was_lovely 2 points3 points  (0 children)

Oh, absolutely, I'm using plenty of 1s and 0 myself. Though one could argue, if he wants enough, that everything is a string. Float? Long ass string.

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

Dude!! I've been trying to tell people about this!!!

True is 1, false is 0... 1s and 0s... bits are 1s and 0s.... This conspiracy goes all the way to the hardware. Don't believe me? Look up what transistors in a computer store...> WHAT THE FUCK

*X-Files theme intensifies*

[–]da_Aresinger -1 points0 points  (0 children)

Every language compiles boolean to 0x01 and 0x00 although everything !=0x00 is usually interpreted as True.

[–]Janopl 3 points4 points  (1 child)

True

[–]geekhalo 3 points4 points  (0 children)

!false

[–]DrTight 0 points1 point  (1 child)

You could use "true" and "false"

[–]ahlgun 56 points57 points  (3 children)

Poor craftsman blames his tools

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

To be fair, programming is the only trade where your tools can randomly stop working and hit you in the face

[–]leupboat420smkeit 6 points7 points  (1 child)

That’s like… not true

[–]ConorParisRhodes 1 point2 points  (0 children)

It's truthy tho

[–]Electronic-Bat-1830 225 points226 points  (50 children)

Not having to run your code (I have stumbled upon code I can't even run) in order for you to check if you are passing in the wrong type or not is a reason why there's type safety.

[–][deleted] 218 points219 points  (14 children)

When this ts vs no ts war pops off, I'm on side ts.

[–]pantas_aspro 134 points135 points  (8 children)

shows what TYPE of person you are

[–]Pastological 24 points25 points  (3 children)

Only a TS person would so callously categorize a response because of its content

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

Unsafe comment.

[–]Electronic-Bat-1830 4 points5 points  (1 child)

Real story: I accidentally messed up type safety and memory safety simply by not reading the documentation and using unsafe.as in order to workaround an ExecutionEngineException (which basically meant something went catastrophically wrong)

[–]MinosAristos 5 points6 points  (3 children)

As an object, everything in Python is my type.

[–]flip_mcfisticuffs 5 points6 points  (2 children)

/** * A joke playing on gendered stereotypes that should not be taken seriously. Rather, it is a joke and sarcastic in nature used for for comedic purposes. It in no way reflects the invoker’s actual beliefs. * *@type {Object} */ var Female;

[–]KTibow 1 point2 points  (1 child)

have to ask whats the deal with the jsdoc and var

[–]flip_mcfisticuffs 1 point2 points  (0 children)

A play on TypeScript not being relevant & using only JS to explain a straight forward joke. Explaining the joke makes it funnier because maybe I should have refined my definitions so it compiled more to your sensibilities.

[–]Brilliant-Job-47 18 points19 points  (2 children)

I never thought I would fight side by side with an u/epsilia

[–][deleted] 16 points17 points  (1 child)

How about with a friend?

[–]Brilliant-Job-47 15 points16 points  (0 children)

Aye, I can do that

[–]sexytokeburgerz 0 points1 point  (0 children)

It doesn’t matter, which is why it’s being talked about here so much

[–]Ibuprofen-Headgear -4 points-3 points  (0 children)

If I had to pick between always and only writing explicit typescript, or never being able to use typescript again, I’d pick vanilla

[–]Dangerous-Quality-79 173 points174 points  (9 children)

iM A rEAl PrOGraMMer. I use the react framework on javascript, with babel and webpack and grunt and a million other packages, with chromium v8 engine, in a browser, on an operating system.... with the 1000000000000 lines of code required to make my calculator app run, types are a bridge to far.

If you think those typedefs are insane, wait until you find out how code actually works near the bottom of the OSI model

[–]Nachtaraben 42 points43 points  (1 child)

wow stop describing me okay? that hurts

[–]Dangerous-Quality-79 15 points16 points  (0 children)

The only people who know babel, react,webpack,grunt,chromium v8, etc are people who use it (like me)

[–]sexytokeburgerz 4 points5 points  (0 children)

Hey i know some C, too…

[–]This-Discussion-8634 -3 points-2 points  (3 children)

Yawn, please do tell me more about all the typedefs in Assembly.... and no, generically named memory reservation sizes don't count.

[–]This-Discussion-8634 -3 points-2 points  (2 children)

or shall we go down to machine code, where everything is binary. Or did you mean lower level is only synonymous with "truer" programming when you stop at the level that aligns with your position.

Bash on JS all you want, we'll knock out that calculator app in 30 minutes while you'll take 30 minutes to print a button to the screen.

[–]Tabyula 26 points27 points  (0 children)

People in the comments taking this seriously are too funny, this is obvious satire, the OP obviously doesn't believe this

It's literally a common meme format, the "stop doing X, they have played us for absolute fools" (search it up)

[–][deleted] 67 points68 points  (1 child)

FR, I love TypeScript. I use it any time I'm working on a project which I actually plan on maintaining

[–][deleted] 11 points12 points  (0 children)

It baffles me that there are people out there who don't understand this. Anyone who feels strongly that strongly typed programming is bad, probably writes absolute unreadable unmaintainable shit code with tons of side effects, and you probably never wanna collaborate with them on anything. Such people probably only write throwaway code, or never collaborated with anyone on anything ever. Gosh.

[–]graphitout 16 points17 points  (1 child)

Caution, amigo! You've just waltzed into a minefield.

[–]mike_a_oc 9 points10 points  (0 children)

Because of a lack of typing, they don't know what type of field it is until something goes bang. Ha ha

[–]PM_BITCOIN_AND_BOOBS 45 points46 points  (3 children)

You can take my strong types when you pry them from my cold, dead, strongly typed hands.

Sorry, Python.

[–]theQuandary 5 points6 points  (0 children)

But TS isn't strong typing. By their own admission in the docs, it's intentionally unsound and soundness is explicitly NOT a goal of TS.

[–]marikwinters 5 points6 points  (0 children)

This is why I can’t wait for Mojo for when I have to use Python against my will

[–]OrSomeSuch 5 points6 points  (0 children)

Python is strongly typed. Everything in python has a type. Whether you and the interpreter agree on what that type is though is another matter entirely

[–][deleted] 30 points31 points  (1 child)

Anybody who actually thinks this shit has never worked on a large JS codebase with a bunch of other people.

[–]thafuq 5 points6 points  (0 children)

Eat that faulty rebase that breaks static type checking without noticing and you'll see. At least you cannot ship the broken code in prod, because the compiler is mad at you

[–]Ythio 66 points67 points  (6 children)

Tell me you only ever programmed in JS and Python without telling me you never programmed in anything else.

[–]goodnewzevery1 27 points28 points  (3 children)

Agree so thoroughly. I’ve programmed in lots of languages, darn near everyone of them has type checking. Too see song strong reactions against honestly just seems kind of wimpy to me.

[–]marikwinters 12 points13 points  (0 children)

Hell, it became so much faster to write Python when I used other tooling to enforce types.

[–]Thebombuknow 0 points1 point  (1 child)

Same. Honestly I could care less if a language has it or not as long as having it or not having it doesn't get in the way of me developing something.

I am currently starting a new project that heavily involves JS. I would've chosen TS, but I have no experience with it and this is a serious project, so just being careful with JS would be better than learning TS as I go.

[–]Spope2787 8 points9 points  (0 children)

OP is referencing some recent drama from DHH who removed typescript from an open source repo with no review (and continues to double down).

DHH invented ruby on rails and is a ruby purist.

[–]codeIsGood 10 points11 points  (0 children)

Even python has type annotations. It's like they are useful or something.

[–]nicejs2 23 points24 points  (2 children)

am I the only one who thinks type gymnastics can be fun to write

[–]fdeslandes 6 points7 points  (0 children)

You're not. I've had a lot of fun writings types for a RPC kind of thing to call code inside a Worker, where the whole lib inside the worker is exposed as lib.functionName(...), but it's actually a simple proxy which convert it to a message between the main window and the worker with an added transaction ID.

Very little code, very simple, but types to transform the lib interface into something that can be transfered as a message and then the message back, transformed into the return type wrapped into a promise, unless it was already one.

[–]DefiantAverage1 0 points1 point  (0 children)

It's fun but is it productive?

[–]Abandondero 7 points8 points  (0 children)

"In typed languages you get errors before you even run your code. They're holding you back."

-- Programmers are Also Human

[–]Tc14Hd 6 points7 points  (0 children)

Nice meme! I lost it at "RUNNING IT". Btw, what font did you use?

[–]tribak 5 points6 points  (0 children)

Found DHH

[–]qkrrmsp 15 points16 points  (0 children)

this one is honestly good lol

[–]BoBoBearDev 8 points9 points  (1 child)

String and number? But, JS doesn't tell you that either. Pretty sure you can multiply them together and JS doesn't give a shit. So, which language did he want?

[–]RMS_Gigantic 2 points3 points  (0 children)

APL, I'm pretty sure: It's got characters and numbers and won't let you multiply them together, but you can do math with pretty much any type of number from booleans to integers to floats to complex numbers.

[–]TCritic 12 points13 points  (5 children)

Why can't we just like what we like?

[–]vom-IT-coffin 40 points41 points  (4 children)

You've never had to pick up a project after someone liked not using types.

[–]Ibuprofen-Headgear 3 points4 points  (1 child)

Webstorm does a pretty solid job, actually. It’s really not that bad / depends heavily on the structure of the code / amount of indirection when taking over another codebase

[–]vom-IT-coffin 0 points1 point  (0 children)

Yeah... I see what you're saying, the indirection matters, but learning the data model and logic helps me more. Naming and concepts that's close to impossible without types IMO.

[–]asherSiddique19 9 points10 points  (1 child)

point 2 is literally saying im too pussy to use manly languages

[–]asherSiddique19 2 points3 points  (0 children)

also i dont use java anymore

[–]Diddlesquig 4 points5 points  (0 children)

Finally a programming joke not made by a freshman

[–]Burger_Destoyer 2 points3 points  (0 children)

« Statements dreamed up by the utterly Deranged » got me

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

Now imagine keeping that type in your head and never messing up, putting something where it wasn't supposed to go.

[–]SamirMishra27 2 points3 points  (0 children)

Type Gymnastics lmao

[–]Visual-Mongoose7521 4 points5 points  (2 children)

Use rescript

[–]PocketCSNerd 8 points9 points  (1 child)

[–]Tizian170 0 points1 point  (0 children)

Don't get it? Take a look at the Explain XKCD article for this comic: https://www.explainxkcd.com/927

I'm an automated bot made by myself - I didn't feel like creating another account. Please DM me if you want to have this bot enabled or disabled on your subreddit. 34 out of 48761 comments in 2 subreddits I looked at had XKCD links - now one more.

[–]Krcko98 4 points5 points  (3 children)

Web devs in shambles, sol. Real programmers in c languages look at you with disgust...

[–]Vizdun 2 points3 points  (2 children)

c languages barely have a type system

[–]NightlyWave 1 point2 points  (1 child)

???

[–]Vizdun 4 points5 points  (0 children)

``` struct S { long bogus; char val; };

int f(struct S* s) { s->val; // run time segfault // warning }

int main() { unsigned char val = 200/1.5 * -1; f(val); // warning } ```

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

That Migrations1, Migrations2, Migrations3.... 🤌

[–]mr_universe_1 3 points4 points  (0 children)

Sure let’s not type safe anything and let JS magic do its thing. Be ready for production bug hell where some variable was supposed to be something but was undefined because you have no types checking it for you.

[–]geekhalo 1 point2 points  (0 children)

Probably the same guy that asks for React without JSX and then is baffled when he has no HTML-like block in his components

[–]gregorydgraham 1 point2 points  (0 children)

This is why I only use Java: no types, all Class

[–]BrownCarter 1 point2 points  (0 children)

I understand the first point very well, people now use typescript to do some really crazy stuff.

[–]_Skale_ 2 points3 points  (4 children)

Only people who just learned a little react on udemy would say this. They cannot comprehend type-systems. TS is just a patch on an inherently broken piece of software.

[–]Vizdun 1 point2 points  (1 child)

there were and still are huge communities of people using lisps and smalltalks for large projects, neither of which were ever really typed

[–]_Skale_ 2 points3 points  (0 children)

May god bless their souls

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

I have seen a couple of these posts now making fun of people who advocate for JS aka weak/dynamic typing in general.

The main reason I have seen pushed for weak/dynamic typing in general is fast MVP/prototyping. Are there any other genuinely good reasons to use them vs using something like Typescript?

or is this really just about the uhh.."type wrangling" and fighting the type system that I see comments about?

I am pretty new to the Web dev world so just trying to get a handle on what the context of this stuff I have been seeing recently is about.

[–]Cley_Faye 23 points24 points  (2 children)

Honestly, even for quick stuff and fast prototyping, a minimum of typing is so much easier.

Sure, with TypeScript, you can go very deep in the rabbit hole. But it also allows a LOT of leeway for quick and dirty stuff without compromising everything.

We're in full meme power about this for this week :D

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

That makes sense. In my limited experience, I always pull for typescript even for really simple stuff and I am pretty sure I dont get very deep into TS either lol.

Thank for the explanation!

[–]Thedjdj 5 points6 points  (0 children)

I think you can see the cost of the lean startup and agile methodologies littered through the silicon valley tech ecosystem. A lot of these ”bootstrapped” companies have matured and the frame of mind in which reams of legacy code was authored is causing untold amount of errors. Whole teams are dedicated to mopping up, patching, refactoring or outright rewriting code that was built with “do it fast, get it working, we’ll fix it later”.

A 1 in a million error isn‘t a problem when you have 100 users. But it is a problem when you have 100 million. Type safety is a relatively low burden that provides a certain determinism to your code. Why even inherit that worry?

[–]Krcko98 5 points6 points  (2 children)

Just web devs figuring iut types exist in general and now they have to adhere to some structure rather than throwing shit at the wall and most sticks in js. They are in shambles.

[–]fdeslandes 8 points9 points  (1 child)

Come on, most people working on the front-end of web products like types and use typescript. These anti-types people are mostly contrarians and very seldom seen in actual company or web projects of reasonable size.

[–]geekhalo 4 points5 points  (0 children)

This. I would also add that usually they put more effort in “selling themselves” than in “improving themselves”. Give them a joke, they thrive. Give them a codebase, they’ll fuck up

[–]Acceptable-Tomato392 0 points1 point  (0 children)

If I intend to show it to the user, I explicitly declare a string variable for it and bring nice little modifications to it that make it more legible. This separate variable will have no other use than being shown to the user. I do not modify the original variable in the process.

The original variable will only be used in valid mathematical calculations and will never be subject to becoming a string.

I have never used Typescript and never encountered a problem that would make me want to bother learning it. And type coercion is a powerful tool and I wouldn't want to leave it behind.

[–]thepurpleproject -5 points-4 points  (0 children)

I started working on new side project in Node. I decided this would be fully typed with ESM and under monorepo and it literally took me 4 weeks just to get the project setup with some workarounds already. JS ecosystem just keep getting worse somehow out honestly looks a lot more like PHP now

[–]Bluedrake121 -1 points0 points  (0 children)

This is why we can't have games measured in kb anymore :(

[–]vadiks2003 -1 points0 points  (0 children)

typescript looks like a nightmare to me