HackerTrans
TopNewTrendsCommentsPastAskShowJobs

rogerkeays

no profile record

Submissions

Re-Evaluating GPT-4's Bar Exam Performance

link.springer.com
122 points·by rogerkeays·vor 2 Jahren·137 comments

[untitled]

1 points·by rogerkeays·vor 2 Jahren·0 comments

Unchecked Java: Say goodbye to checked exceptions

github.com
143 points·by rogerkeays·vor 3 Jahren·291 comments

Fluent: Static Extension Methods for Java

github.com
79 points·by rogerkeays·vor 3 Jahren·114 comments

comments

rogerkeays
·vor 2 Jahren·discuss
Andrews PW, Thomson JA Jr. The bright side of being blue: depression as an adaptation for analyzing complex problems. Psychol Rev. 2009 Jul

https://www.ncbi.nlm.nih.gov/pmc/articles/PMC2734449/
rogerkeays
·vor 3 Jahren·discuss
Good point. Actually the plugin didn't handle this case either (fixed now). Thanks for the feedback.
rogerkeays
·vor 3 Jahren·discuss
You don't think it would limit the independent use of f()?
rogerkeays
·vor 3 Jahren·discuss
This language looks really cool. Thanks for sharing.
rogerkeays
·vor 3 Jahren·discuss
You can also rethrow checked exceptions as runtime exceptions by exploiting type erasure:

    public static RuntimeException unchecked(Exception e) {
        Exceptions.<RuntimeException>throw_checked(e); 
        return null; 
    }
    private static <E extends Exception> void throw_checked(Exception e) throws E {
        throw (E) e;
    }
then you can do this:

    try { ...
    } catch (IOException e) {
        throw unchecked(e);
    }
And the original exception is thrown without being wrapped. It's as though you had `throws IOException` on your method signature.

This is from my original solution to the problem: https://github.com/rogerkeays/jamaica-core/blob/0cc98b114998...
rogerkeays
·vor 3 Jahren·discuss
... not sure if serious or not
rogerkeays
·vor 3 Jahren·discuss
I put Java's popularity down to good support for Corporate-Oriented Programming ;)
rogerkeays
·vor 3 Jahren·discuss
You still get warnings about checked exceptions from this plugin, so it's not entirely flying blind.
rogerkeays
·vor 3 Jahren·discuss
I think this project shows how trivial it is to convert checked exception errors to compiler warnings.

https://github.com/rogerkeays/unchecked/blob/f22c8cde3557de0...

No need to change the type hierarchy. Just make it a compiler option.
rogerkeays
·vor 3 Jahren·discuss
Good point...
rogerkeays
·vor 3 Jahren·discuss
Ha, yeh. At first I had the command line examples first, but everyone was going on and on about maven and stuff, so I figured that's what the audience wants.

[EDIT] I moved the command line stuff back to the top of the README. XML makes my eyes bleed too...
rogerkeays
·vor 3 Jahren·discuss
The "what to do" and "tests" sections of this article is spot on! As for the sociopath/psychopath distinction, I think both terms refer to people with a Cluster B personality disorder. Since this is such a mouthful, I just call them predators, or if I don't want to scare people: vogons.
rogerkeays
·vor 3 Jahren·discuss
OK, sorry.
rogerkeays
·vor 3 Jahren·discuss
and a MyStringBuilderInterfaceProxyFactory too of course
rogerkeays
·vor 3 Jahren·discuss
The JDK team won't like this. As it is Fluent, Lombok, and (I presume) Manifold are using all sorts of unsupported hacks to access compiler internals. If you restrict yourself to the compiler plugin API you don't get much mileage.
rogerkeays
·vor 3 Jahren·discuss
sweet
rogerkeays
·vor 3 Jahren·discuss
IDEs are not my strong point. Aren't they smart enough to just search static methods in the scope of the compilation unit? Okay, so they have to be indexed first I suppose, but still... Ah, I suppose you want to search for methods you haven't imported yet. Now I get the annotation stuff. We're writing code for the IDE.
rogerkeays
·vor 3 Jahren·discuss
How do you do the same thing to java.lang.String?
rogerkeays
·vor 3 Jahren·discuss
Nice example. The extra parameters really drive the point home. Hope you don't mind if I steal it for the README.
rogerkeays
·vor 3 Jahren·discuss
I don't know yet. I'm already using some of my own variations of sneakyThrows, but what I really want is just to disable the whole damn thing in the compiler (checked exceptions are a compiler feature, not a JVM feature). I won't be changing the Java syntax though, sorry!