this post was submitted on 04 Nov 2025
170 points (98.3% liked)

Ask Lemmy

35420 readers
1655 users here now

A Fediverse community for open-ended, thought provoking questions


Rules: (interactive)


1) Be nice and; have funDoxxing, trolling, sealioning, racism, and toxicity are not welcomed in AskLemmy. Remember what your mother said: if you can't say something nice, don't say anything at all. In addition, the site-wide Lemmy.world terms of service also apply here. Please familiarize yourself with them


2) All posts must end with a '?'This is sort of like Jeopardy. Please phrase all post titles in the form of a proper question ending with ?


3) No spamPlease do not flood the community with nonsense. Actual suspected spammers will be banned on site. No astroturfing.


4) NSFW is okay, within reasonJust remember to tag posts with either a content warning or a [NSFW] tag. Overtly sexual posts are not allowed, please direct them to either !asklemmyafterdark@lemmy.world or !asklemmynsfw@lemmynsfw.com. NSFW comments should be restricted to posts tagged [NSFW].


5) This is not a support community.
It is not a place for 'how do I?', type questions. If you have any questions regarding the site itself or would like to report a community, please direct them to Lemmy.world Support or email info@lemmy.world. For other questions check our partnered communities list, or use the search function.


6) No US Politics.
Please don't post about current US Politics. If you need to do this, try !politicaldiscussion@lemmy.world or !askusa@discuss.online


Reminder: The terms of service apply here too.

Partnered Communities:

Tech Support

No Stupid Questions

You Should Know

Reddit

Jokes

Ask Ouija


Logo design credit goes to: tubbadu


founded 2 years ago
MODERATORS
 

Personally I love oranges but cant stand orange juice.

you are viewing a single comment's thread
view the rest of the comments
[–] Professorozone@lemmy.world 2 points 2 days ago (2 children)
[–] invertedspear@lemmy.zip 5 points 2 days ago (1 children)

In programming you declare variables. To keep it simple let’s say there are only 2 types, numbers and words.

Now 1 is obviously a number, and ‘word’ is obviously a word. If I ask you to divide 100 by ‘word’ you’d have to tell me that’s not possible.

Now what if a say divide 100 by the “word” ‘10’? Well I’m a strongly typed programming language, you’d have to tell me “well, because you defined it with the single quotes, that’s actually a word so you can’t do math on it.” In a loosely typed language you’d be like “yeah I get that ‘10’ meant the number 10 so I’ll do the math.

This creates amusing weirdness in loosely typed languages, especially when they use math operators to represent word actions. For instance JavaScript is infamously loosely typed and uses the + sign to join words together so if I say ‘Java’ + ‘Script’, I get back ‘JavaScript’. So all the following are true in JavaScript:

1+1=2 1-1=0 ‘1’+1=11 because the ‘1’ makes it think you want to join words and it converts the second number 1 to a word ‘11’-1=10 because there’s no word operation applied to the minus sign, so it converted the word ‘11’ to a number

There’s lots of other tomfoolery, but I’m trying to keep the explanation simple. But any mixing of words and numbers in a strongly typed language would just give you an error.

I’m with the top reply of this thread, you don’t need strong typing if you understand what the code does.

[–] jimmux@programming.dev 3 points 2 days ago (1 children)

I think strong/static typing with inference is the sweet spot. Complex types can change, so it helps to at least have your boundaries well defined. Within the scope of a function, if you need explicit typing on everything then your function might be getting too complex.

[–] OpenStars@discuss.online 1 points 2 days ago

Careful - you are going to be liking Perl before you know it:-).

[–] chunes@lemmy.world 1 points 2 days ago

It's a feature of a programming language that usually, but not always, requires you to declare what sort of data everything is (this is a number, this is text, this is a person object I made, etc.). Then you are required to run your program through a program called a compiler before you are allowed to run it, to (among other things) make sure that everything is what you said it was.

Basically, it requires you to be extra pedantic, but some say it catches common errors. But imo these are the sort of errors that only come up because you have tons of people working on one project.