this post was submitted on 05 Oct 2024
75 points (93.1% liked)

Programming

17133 readers
417 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] fruitycoder@sh.itjust.works -4 points 20 hours ago (1 children)
[–] Traister101@lemmy.today 8 points 19 hours ago (1 children)

They specified statically typed languages. Python would be dynamically typed

[–] MajorHavoc@programming.dev 0 points 15 hours ago (1 children)

Python is dynamically typed by default, but lots of Python is statically typed.

[–] Traister101@lemmy.today 2 points 14 hours ago

No python is statically typed. You have type hints, which makes the language tolerable but like their name implies it's a hint at the type. You can perfectly legally pass in something completely different that doesn't conform whatsoever.

The primary thing static languages provide is static typing, that being the ability to determine before runtime that all the types are valid. A good example of this is how C++ programs will refuse to compile if you try to invoke a method that doesn't exist on the type. That's because it's statically typed. At compile time you know that the code is wrong. Dynamic languages fundamentally don't work like that. You cannot know until runtime if the method you called or the field you are trying to touch exists or not. Again type hints help a lot with this but that doesn't change how the language actually operates.