r/programming • • Dec 08 '19

JSON Decoding in Elm

https://functional.christmas/2019/8
73 Upvotes

56 comments sorted by

View all comments

Show parent comments

7

u/kankyo Dec 08 '19

Having a hard decode error IS breaking. It won't crash but it will absolutely not work.

1

u/CarolusRexEtMartyr Dec 08 '19

How often does the data representation change without requiring the program to change?

6

u/kankyo Dec 08 '19

When it's outside your control? All the time. Otherwise probably not a lot.

Still that is not relevant here. My point was that just saying "It's not a crash so it still works" is bs.

1

u/DoctorGester Dec 08 '19

What do you suggest should happen instead?

2

u/kankyo Dec 08 '19

Crashing is ok if the situation can't be handled and as long as the crash can be logged. That's one thing.

But it's a good thing that Elm is strict about this. I was one of the strongest advocates for starting to use Elm in prod at work. But saying that it's not a fatal error just because it has been forced to be dealt with is still bs. We should not over sell stuff.

5

u/DoctorGester Dec 08 '19

A fatal error is when your hard drive suddenly catches on fire during file read. An input parsing error is a part of your program and you should be able to handle it, not view it as an "exception".

→ More replies (0)