You are viewing a single thread.
View all comments View context

I think the way some dynamically typed languages use maps is interesting. In most languages if you have a hashmap, all values have to have the same type. In a dynamic language you can have some members be methods, some members be values of potentially different types and so on. Of course, depending on what you want to achieve, you might be able to use a struct for example. A map is more flexible though. You can union two different maps, or you can have a function that takes a map that has either a or b. It’s not necessarily impossible to express this in static types either, but there are many things here that quickly become tedious to do with types that Just Work in dynamically typed languages.

permalink
report
parent
reply

Programming

!programming@programming.dev

Create post

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



Community stats

  • 3.5K

    Monthly active users

  • 1.7K

    Posts

  • 28K

    Comments