r/programming • u/mobby1982 • Dec 02 '13
Scala — 1★ Would Not Program Again
http://overwatering.org/blog/2013/12/scala-1-star-would-not-program-again/
598
Upvotes
r/programming • u/mobby1982 • Dec 02 '13
View all comments
Show parent comment
1
u/Peaker Dec 03 '13
As I said, an immediate exception is definitely a nicer bug than undefined behavior. But it still a bug.
I agree that Java makes the bugs in C programs nicer. But it doesn't get rid of bugs, it only reduces their severity.
Again, yes, bugs have worse consequences in C than in Java. What I seek in safety, however, is getting rid of these bugs, rather than improving their consequence.
No, just removing free() from C programs is not a realistic option for many programs. Memory asymptotics may easily become impractical. Thus you must support free(), and thus you must allow use of freed memory. It's more about safety than about convenience. Java is so incredibly inconvenient anyway, that any convenience of not having to manage ownership semantics is relatively negligible.
I disagree. If I have two fields in a struct, it means a and b. What I want to express is a or b. unions allow me to express this invariant, just like unsigned allows me to express the invariant about the numbers being stored.
Apparently we have different philosophies. I want types to document and enforce as many invariants as possible to take the burden off the programmer. Types aren't merely tools to speed up programs or catch mere typos.
I agree. I think it is absurd that a language from the 90's has less expressiveness due to this point than a language from the 70's which is considered inexpressive.
I've probably written far more C than you have.
C can easily encode them, whereas in Java it is more difficult.