Y
HN Search
Hacker News Search
new
|
comments
|
top
|
jobs
ragnese
searching PlanetScale…
1.
▲
2.
▲
3.
▲
4.
▲
5.
▲
6.
▲
75 ms
·
691.
▲
by
ragnese
6y ago
Sounds like an issue with generics and lambdas in Java
692.
▲
by
ragnese
6y ago
But Java has no language support for dealing with a Try/Result type. It would be objectively worse than just using checked exceptions, IMO.
693.
▲
by
ragnese
6y ago
Except that many languages just do worse. Go, Kotlin, Clojure (very different philosophy, though), C#...
694.
▲
by
ragnese
6y ago
You aren't forced to write your happy path code well, either. What's your point?
695.
▲
by
ragnese
6y ago
Kotlin has no mechanism to force error handling. You may suggest that we use sealed classes as return values and match on them, which is okay-ish, but suffers from two big issues: 1. You are not forced to use the result, so if you call a fu
696.
▲
by
ragnese
6y ago
The language isn't forcing you. The developer who chose to use a checked exception is forcing you. Is the language "forcing" you when someone writes a function that returns a String? What if I wanted it to be an Int?
697.
▲
by
ragnese
6y ago
The way Rust does it is not perfect, but it's the best I've used so far, IMO. Rust, if you are not familiar, has a special operator that let's you call a function that returns Result and automatically unwrap it and return ear
698.
▲
by
ragnese
6y ago
I suspect that most Java devs have literally never considered anything beyond "Handle it here or rethrow it as-is".
699.
▲
by
ragnese
6y ago
> The way I see it, simple code must be simple. If you want to do complex things, the language should allow you to do it some way. But not at the expense of everyday tasks. It's an elemental usability consideration. As you already m
700.
▲
by
ragnese
6y ago
> You can hide it by transforming that checked exception into something specified for your API. At this point, what benefit have you gained from SQLException being a checked exception? You're hiding that detail. This is what you sho
701.
▲
by
ragnese
6y ago
I fucking hate SQLException. It's a giant pain in the ass to dissect it to figure out if it's an error because the database exploded, or because I made a syntax error, or because something real failed like a uniqueness or foreig
702.
▲
by
ragnese
6y ago
I don't use any of the Rust error helpers. I don't mind a bit of boilerplate. I don't hate Java's checked exceptions. But I also actually craft my own Exception types when I write a Java package. I think that's the
703.
▲
by
ragnese
6y ago
I don't believe so, no. You can set panics to automatically abort, though. But that's opt-in. The real point is that panics are absolutely unchecked exceptions, but it's really awkward to catch them and the standard library
704.
▲
by
ragnese
6y ago
So you're saying checked exceptions are perfectly fine. I'll write my library code with checked exceptions. You call my library code in one of your methods. The compiler tells you to do something about the possible failure. If you
705.
▲
by
ragnese
6y ago
Kotlin made the worst mistake here. At least Scala actually gives you ways to do error handling somewhat ergonomically with for comprehensions. Kotlin gives us nothing. Sure, you're "supposed" to return sealed classes and mat
706.
▲
by
ragnese
6y ago
> But then there are other types of checked exceptions that are almost certainly unrecoverable because they happen way down in some other third party code. And then you get the endless chain of "throws" all the way back up the
707.
▲
by
ragnese
6y ago
You still need unchecked exceptions for errors that truly should never happen and are not accounted for. Even Rust and Go have unchecked exceptions in the form of "panics".
708.
▲
by
ragnese
6y ago
I think that neither of those are Java's worst offense. It's that all references are allowed to be null.
709.
▲
by
ragnese
6y ago
Then just wrap them in RuntimeException and rethrow them. I mean, why are you writing a kleenex program in Java? Do you not want to declare a return type for your functions either? Java's checked exceptions are just a way to return mul
710.
▲
by
ragnese
6y ago
Really? How so? I thought the whole reason it won over XML for HTTP stuff was precisely because it could be easily written and read by humans.
711.
▲
by
ragnese
6y ago
Decent programmers really don't have that much issue learning new stuff. That's not to say I haven't met a good number of people who have only ever programmed e.g., Java, and poorly at that. But I wouldn't even hire them
712.
▲
by
ragnese
6y ago
I somewhat disagree. This will be true for pretty much any non-trivial code project. I'd love to see a language where I didn't need tools to understand what's happening, but that's impossible currently. Do you really nev
713.
▲
by
ragnese
6y ago
I live in a nearly perpetual state of outrage over the need to sign in and be tracked for things that have absolutely no reason to require an internet connection. I'm even more outraged when I see popular video games that are clearly t
714.
▲
by
ragnese
6y ago
I feel like Rust is doing pretty well for itself, in light of the VAST inertia that C and C++ have. A bunch of big names in tech are adopting Rust: (obviously) Mozilla, Microsoft, Cloudflare, Dropbox, IIRC. That's not bad for a languag
715.
▲
by
ragnese
6y ago
Right. Good point. I use row locks in my transactions as well. I always have to refresh myself on the isolation levels.
716.
▲
by
ragnese
6y ago
I don't know if it's worth a damn, but I have no idea what the acronym stands for. I'm sure I knew it at some point and I know it's a database compliance standard kinda thing. But I use the shit out of transactions. I ra
717.
▲
by
ragnese
6y ago
Reddit was fairly popular before Digg killed itself. I remember reading about the Digg exodus on Reddit.
718.
▲
by
ragnese
6y ago
Good point. I also thought the same thing about SnapChat. I may be wrong about all three!
719.
▲
by
ragnese
6y ago
To be fair, I do get a good chuckle out of some of the pun chains...
720.
▲
by
ragnese
6y ago
Possibly. But have you seen the "this subreddit is only available on the app" page you get when you visit certain subreddits while on a mobile browser? Simply changing the url to old.reddit.com "reveals" that it's c
More ›