Fork me on GitHub
#off-topic
<
2019-06-03
>
drewverlee16:06:55

Wait, JavaScript has the idea of minus zero?! Is there some mathematical basis for that?

fergalbyrne16:06:15

Yes there are two floating point zeros.

fergalbyrne16:06:48

It’s in the standard AFAIK, not just in JS.

dpsutton16:06:20

numeric representations don't have to be unique. seems like js treats them as unified?

dpsutton16:06:28

its similar to 1/2 = 2/4

fergalbyrne16:06:45

I think === fails though.

fergalbyrne16:06:36

The problem with float or double is they underflow towards zero when you make numbers too small.

dpsutton16:06:44

i don't see how that's relevant. there's lots of strange things with float or double.

fergalbyrne16:06:47

According to https://stackoverflow.com/questions/7223359/are-0-and-0-the-same it’s so you may have 1/-0 = -INF, 1/0 = INF if your float implementation supports that.

fergalbyrne16:06:40

It was http://Object.is that fails (or succeeds), I’d forgotten which.

dpsutton16:06:26

ah interesting

lilactown21:06:25

digging into a medium-sizeed plain JS React app created by someone who's not so strong on app architecture, and I 💯 understand why people clamor about typescript

lilactown21:06:24

things are nested 20+ levels with implicit data contracts, lots of indirection

dpsutton21:06:33

the typescript kept this person in line or created a rats nest?

kulminaator21:06:03

i understood that there was no typescript

dpsutton21:06:19

ah rueing the lack of ts

lilactown21:06:39

I can see how having a compiler track the data contracts would ameliorate some of the pain of making changes

💯 1
Daniel Hines21:06:14

This is how I feel. If I’m going to work with poorly designed systems, I want types to make it more tractable for me.

lilactown21:06:13

right. it's unfortunate that you eventually run up on: "I would like to design this better, but my type system won't let me"

kulminaator21:06:55

medium sized plain js <anything> app are loads of fun if fundamentals are missing or wrong 🙂

lilactown21:06:49

but in leu of good design, maybe having a tool that helps manage it is better? It's kind of a conundrum

Daniel Hines21:06:41

One of my first tasks at my current job was overhauling the major sections of the app to TS. It was like cleaning out a junk drawer - the types turned up so much redundant and sometimes just wrong code. It was an extremely helpful exercise for me to understand the code base.