this post was submitted on 09 Feb 2024
93 points (89.1% liked)

Programming

17392 readers
153 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 [email protected]



founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 32 points 9 months ago (5 children)

Yeah! And integers do way too many things as well. Counters, indexes, number of orange slices in an orange, there's just no end to the wacky things people try to make integers do, and it's impossible to keep track of it all when looking at code. And floats? Don't get me started on floats. Angles, probabilities, weights, heights, degrees of separation from Kevin Bacon ... I'm getting dizzy just listing all these different things that floats do.

It's a big problem, because there isn't an easy way to fix it in every programming language known to man, and someone needs to write more articles about this to get more hits for their sites.

[–] [email protected] 1 points 9 months ago* (last edited 9 months ago)

You joke, but Rails actually does make Integer do too many things lol. I’d argue they’re useful things, but it does so by patching the core Ruby Integer class :p

[–] [email protected] 3 points 9 months ago (1 children)

What's the meaning of a fractional "Degree of Kevin Bacon"?

[–] [email protected] 2 points 9 months ago

The analytic continuation of KB(x) to the complex plane subject to a superconvexivity constraint is unique but doesn't necessarily have a straightforward geometric interpretation

[–] [email protected] 11 points 9 months ago* (last edited 9 months ago)

I think the article makes a good point, but perhaps I'm over-interpreting. It's not that we should stop using strings. It's that we should use the type system to separate different kinds of strings and enlist the compiler's help to detect incorrect mingling of them. So for example a symbol type would only permit strings that contain ASCII letters, underscore and digits, and concatenation with / conversion to plain strings would be limited.

[–] [email protected] 3 points 9 months ago

It's definitely a rule that can be taken so far that it is counterproductive, but I think it's good practice to thbk about how I could use something other than a raw string ( even if it's just a constant defined somewhere )

[–] [email protected] 31 points 9 months ago (2 children)

Wait till you hear what strings are under the hood. Integers in a trench coat!

[–] [email protected] 5 points 9 months ago

It’s integers all the way down.

[–] [email protected] 22 points 9 months ago (1 children)

And the boolean is revealed as the archvillain working behind the scenes, pulling the strings of all its minions.

[–] [email protected] 4 points 9 months ago

You thought it was true but it was I, One!