|
rotor posted:it seems like there should be a legend of Zelda analogy that would help this guy out A monad is like Twilight Princess in that all the review sites said it was great and then you used it for a while and didn't have any fun and then never played Skyward Sword.
|
# ¿ Dec 11, 2014 22:12 |
|
|
# ¿ May 9, 2024 19:21 |
|
Progressive JPEG posted:if i liked twilight princess should i try skyward sword?? You may have liked it because you didn't have to waggle in order to swing your sword. This is similar to monads because
|
# ¿ Dec 12, 2014 16:27 |
|
Yes: http://docs.oracle.com/javase/8/docs/api/java/util/LinkedHashMap.html
|
# ¿ Dec 24, 2014 19:44 |
|
Max Facetime posted:or just check for nulls in a less stupid way: Eclipse will still flag a bunch of this stuff as "potential" null pointer accesses, because who can say that the second or third call to getSoundcard() won't suddenly return null!? Also, Eclipse has no idea how to do null analysis on that Optional class. Basically, null analysis should be built into the drat language already.
|
# ¿ Dec 27, 2014 22:36 |
|
VikingofRock posted:Also C++ has its warts but it is a much, much, much, much, much better-designed language than javascript. One usually is greater than zero, yes.
|
# ¿ Jan 21, 2015 07:26 |
|
I had a professor in college who insisted that we create every frame and dialog our program was ever going to display ahead of time. Like, when the program started. So, instead of: *click a button* *slight pause while dialog is built*, it became: *run the program* *long-rear end pause while everything is built*. I get that, sometimes, JIT is Just Too Late, but man, that was some obnoxious code style. Meanwhile, the other members of my group made their dialogs appear when the program started, so like twenty windows would immediately pop up.
|
# ¿ Feb 4, 2015 16:19 |
|
Shaggar posted:the two major gui apis for java (swing and eclipse swt) haven't changed since java 1.4. Hey, they added generics to things like JList. So now you can pass a Vector<? extends E> to the JList constructor.
|
# ¿ Feb 5, 2015 16:28 |
|
Shinku ABOOKEN posted:this is why i was playing with kotlin And in between the two is List<Butt> todolist = new ArrayList<>().
|
# ¿ Apr 12, 2015 17:51 |
|
Notorious b.s.d. posted:this is really important Sounds like you should have used List instead of ArrayList when you declared your local variable!
|
# ¿ Apr 12, 2015 18:55 |
|
fleshweasel posted:no, it's much better to be able to switch to any type in the universe than to be able to switch to another List implementation. I'd like to see some Java code that called get(int) on a List all over the place, then suddenly started calling get(Integer) on a Map, because the return type of some method changed. Of course, if your code is using an API whose designers found it acceptable to change a return type from List to Map, you've got bigger problems.
|
# ¿ Apr 12, 2015 19:28 |
|
Man, what even is the point of functional programming? Every time I see it, I think, "Way to go! You computed a value!"
|
# ¿ Apr 21, 2015 16:33 |
|
In Java, I can make lots of things to click on.
|
# ¿ Apr 21, 2015 22:04 |
|
And with functional programming, you compute your one value and you're done. There aren't even any buttons to click on. What a silly thing.
|
# ¿ Apr 22, 2015 00:58 |
|
The worst part of java.util.Optional is that Eclipse still can't apply @NonNull and @Nullable to it. Java 9 had better bring those annotations into the language specification.
|
# ¿ Apr 30, 2015 16:24 |
|
I think it has something to do with cancer
|
# ¿ May 4, 2015 06:19 |
|
MononcQc posted:it's a whole language where you can go global_locations => glob_allocations, experts_exchange => expert_sex_change or whatever Speaking of Experts Exchange, there's a class in our code called "CommentUtilityModel" and I laugh every time I use Eclipse's initial-based autocomplete to type it.
|
# ¿ Jun 5, 2015 19:28 |
|
You know what's sick? Declaring an enum in Java that has a function pointer as one of its member variables, then passing an value of that enum to some function and having it go VALUE.getFunction().apply(whatever) Oh man why did they wait until Java 8 to add these things?
|
# ¿ Jul 21, 2015 16:29 |
|
rrrrrrrrrrrt posted:you could pretty much always do this? nothing stopping an enum from holding a bunch of static objects implementing "functional" interfaces in java pre 8 But now you can write stuff like Something::fart and you don't need the static objects. It takes away an ugliness hurdle, making it more likely that you'll use the pattern effectively.
|
# ¿ Jul 21, 2015 18:22 |
|
Mr Dog posted:Static analyzers can catch uses of null in packages where you've declared null off-limits Yeah, my favorite part about Optional is that Eclipse still can't tell whether it's @NonNull or @Nullable, completely defeating the purpose. Stupid Oracle needs to bring @NonNull and @Nullable into the dang language specification already.
|
# ¿ Jul 27, 2015 05:05 |
|
Pie Colony posted:nested classes are statically bound and not part of the instance of the enclosing object. essentially this will lead to a bunch of fun problems you discover a little too late. this is one example, similar situations arise when Outer actually starts to reference or instantiate Inners Well that's what you get for using "Inner" twice.
|
# ¿ Jul 27, 2015 23:18 |
|
Every now and then, I notice "Since 1.1" in the Java API documentation and try to imagine what Java 1.0 was like and why anybody wanted to use it.
|
# ¿ Sep 9, 2015 15:26 |
|
I got to file a JVM bug with Oracle because this compiles but doesn't run:code:
Edit: Added "static" to A.print(). CPColin fucked around with this message at 05:07 on Nov 1, 2015 |
# ¿ Nov 1, 2015 01:14 |
|
Brain Candy posted:no instance of B, so yeah, should be blowing up during the compile Dang it that A.print() method is supposed to be static. Both the javac compiler and the one Eclipse uses let it through, but it fails at runtime because A isn't public. Even though you can call B.print() just fine normally. pepito sanchez posted:you could make B a nested static class in A and it'll work with some refactoring. what were you really trying to do? We've got generated code as a base level and hand-written code that extends it. The base level is supposed to be package-private, because we don't want everywhere else making references to it instead of going through the public classes. I had some utility code that was trying to use a method reference to call stuff in the package-private base classes and the JVM choked on it with IllegalAccessExceptions. Eclipse was being smarter than javac, by calling the reference "B.print()" in the compiled classes. The stock compiler was referencing "A.print()," even though that would be illegal at compile time. CPColin fucked around with this message at 05:10 on Nov 1, 2015 |
# ¿ Nov 1, 2015 05:07 |
|
Yeah, that was when I sighed and figured I'd better file it. I even included that line in the report, so they can't claim the method reference shouldn't work.
|
# ¿ Nov 1, 2015 20:40 |
|
And what's the deal with lines ending in semicolons!?
|
# ¿ Nov 11, 2015 05:46 |
|
piratepilates posted:ceylon seems kind of neat but seems to go so hard with the type system that I can't get through the docs before wanting to give up on all of it I want to see what the bytecode the compiler makes looks like.
|
# ¿ Mar 15, 2016 17:24 |
|
Eating poop is dumb because every line starts with a colon.
|
# ¿ Mar 15, 2016 18:14 |
|
I might try to learn Ceylon. Send help.
|
# ¿ Mar 19, 2016 22:29 |
|
Notorious b.s.d. posted:java will get a 'var' type thing sooner or later. (probably not in java 9 tho) Haha why would they introduce both "var" and "val" instead of "var" and "final var"?
|
# ¿ Mar 21, 2016 22:34 |
|
So make your IDE automatically add "final" when you have a value that can use it? (Eclipse can already do this.) I'm just saying, why add two keywords when the "final" keyword is already sitting right there?
|
# ¿ Mar 21, 2016 23:10 |
|
That "final" keyword is, admittedly, pretty worthless in Java. I see some people insist on putting it on all method parameters. I always want to ask what that's protecting against.
|
# ¿ Mar 21, 2016 23:19 |
|
Soricidus posted:because that's worthless. the value of the distinction is that it captures your intention. adding final automatically just captures the status quo at some arbitrary point in the process of typing in the code, which doesn't tell you anything about whether the variable is supposed to be mutable or not. So type "final" when you declare the variable? Of course, it's still going to be worthless anyway, because you can still probably mutate the poo poo out of whatever object you just declared. quote:and what's wrong with having two reserved type names instead of one? the proposal explicitly doesn't make them full keywords, so your variable called val isn't going to become illegal. and if you have an existing class called val then frankly you deserve everything you get. I dunno, I just figured the java designers usually have such a boner for reusing keywords, they might reuse one in this case.
|
# ¿ Mar 22, 2016 00:17 |
|
I hope everybody understands I'm not defending Java's stupid "final" keyword. I agree that it's pointless most of the time. By extension, "val" would be, too. Ceylon seems to get it right (for modern values of "right"); immutable is the default and you have to annotate stuff with "variable" to make them behave otherwise.
|
# ¿ Mar 22, 2016 00:28 |
|
Soricidus posted:10 PRINT "Why do A when you can just do B?" 10 END
|
# ¿ Mar 22, 2016 21:25 |
|
That line could use font::canDisplay, too, instead of the arrow syntax. I'm not sure which version is more clear, though.
|
# ¿ Apr 24, 2016 16:04 |
|
The code_length field for each method in a Java class takes up four bytes, but:Java Language Spec posted:code_length Thanks a lot, Sun.
|
# ¿ May 16, 2016 22:49 |
|
Yep. They have room for larger methods, but the spec specifically forbids them. The method that gave me trouble yesterday was the static initializer for an enum, which is even better, because the compiler generates that method, so you can't quickly see how large it's getting. Fortunately, a bunch of the values in the enum were useless and I was able to get rid of them, but still.
|
# ¿ May 17, 2016 15:11 |
|
Using code generation to generate it! Never cleaning up unused values! Wishing different decisions had been made eight years or so ago!
|
# ¿ May 17, 2016 18:15 |
|
That's still my favorite dumb justification for allowing underscores in integer literals in Java 8: you can make telephone numbers more readable. Because you're storing telephone numbers in int variables. And typing them in your code. For some reason.
|
# ¿ May 17, 2016 19:36 |
|
|
# ¿ May 9, 2024 19:21 |
|
Oh I was wrong. It was Java 7 and the examples were credit card numbers and SSN's: http://docs.oracle.com/javase/7/docs/technotes/guides/language/underscores-literals.html
|
# ¿ May 17, 2016 20:14 |