• 0 Posts
  • 15 Comments
Joined 2 years ago
cake
Cake day: July 1st, 2023

help-circle




  • Well, but then you’re basically just pushing the mutability onto the container

    That’s the point, when programming with immutable structures you always pass the mutability onto the enclosing structure.

    It’s a good strategy at times though. Like say you’re working in a language where strings are immutable and you want a string you can change. You can wrap it in a list along the lines s=['foo'] and pass references to the list around instead. Then if you go s[0]='bar' at some point, all the references will now see ['bar'] instead.

    A list is an antipattern here IMO. Just wrap it in some dedicated object (see e.g. Java’s StringBuilder).











  • If you live in the USA you don’t suffer from the problem it solves because you have ~5 IP v4 addresses per capita (totaling to 41% of all the IP v4 addresses), and likewise many european countries have ~2 per capita (although there are expeptions like Italy and Spain which are a bit under 1 per capita). However many other countries don’t have such luxury, for example in india there’s one for every 36 people, which is obviously not enough and thus they have to either use NAT everywhere or switch to IPv6.