|
ArrowAssoc doesn't really matter that much, as it's the same as.code:
|
# ? Mar 14, 2016 09:10 |
|
|
# ? May 28, 2024 23:13 |
|
In that case you're basically back to the java version.
|
# ? Mar 14, 2016 13:40 |
|
Except that the scala version just uses a list of pairs whereas the java version uses a bespoke MapArg22 type. Also when you get key/values out of the java you get a bespoke KeyValue object back. Java really needs tuples in the stdlib
|
# ? Mar 14, 2016 13:59 |
|
gonadic io posted:Except that the scala version just uses a list of pairs whereas the java version uses a bespoke MapArg22 type. Also when you get key/values out of the java you get a bespoke KeyValue object back. Java really needs tuples in the stdlib It has AbstractMap.SimpleEntry. And every time I've tried to use it, I've found myself too annoyed at the excessive verbosity of Java to follow through, and end up finding some other solution.
|
# ? Mar 14, 2016 14:41 |
|
gonadic io posted:Except that the scala version just uses a list of pairs whereas the java version uses a bespoke MapArg22 type. Also when you get key/values out of the java you get a bespoke KeyValue object back. Java really needs tuples in the stdlib Thank you, this was my point, not the arrow syntactic sugar. Someone implied that there wasn't really a better alternative for the Java version, and the Scala makes it clear that with tuples and varargs there's a cleaner alternative.
|
# ? Mar 14, 2016 15:54 |
|
every language should have tuples
|
# ? Mar 14, 2016 16:31 |
|
Tuple types have always struck me as a bad idea because to some extent they defeat strong typing. A set of 2d cartesian coordinates, 2d polar coordinates, the dimensions of a rectangle or a complex number can all be represented with a pair of floats, but they have distinct semantic meanings and are not necessarily interchangeable. In a weakly-typed language I guess this is a moot issue.
|
# ? Mar 14, 2016 17:26 |
|
Internet Janitor posted:Tuple types have always struck me as a bad idea because to some extent they defeat strong typing. A set of 2d cartesian coordinates, 2d polar coordinates, the dimensions of a rectangle or a complex number can all be represented with a pair of floats, but they have distinct semantic meanings and are not necessarily interchangeable. In a weakly-typed language I guess this is a moot issue. That is true, but the advantages that they have with respect to code simplicity and reuse are worth it. Plus you can always define newtypes around your (int, int) for polar vs cartesian. Bonus points if your language enforces newtypes.
|
# ? Mar 14, 2016 18:08 |
|
code:
Sinestro fucked around with this message at 18:14 on Mar 14, 2016 |
# ? Mar 14, 2016 18:11 |
|
Internet Janitor posted:Tuple types have always struck me as a bad idea because to some extent they defeat strong typing. A set of 2d cartesian coordinates, 2d polar coordinates, the dimensions of a rectangle or a complex number can all be represented with a pair of floats, but they have distinct semantic meanings and are not necessarily interchangeable. In a weakly-typed language I guess this is a moot issue. For me tuples are nearly always for when I need to stuff some things into a collection, do like 2 things to that collection, then pull things back out. In those situations, there's not a compelling reason to create something more specific. If the collection is going to live longer then the function I'm using it in, then maybe it's time for something a bit more structured. Like if I just have a bunch of keys+values and I want to sort on the keys to operate on the values in a particular order, there's a bazillion collections out there that take in <k,v> tuples and offer the key sorting for me. In that case, the collection is basically just thrown away when I'm done and I'm essentially using it as a glorified way to build a sorted queue without actually having to do the sorting (worse) myself.
|
# ? Mar 14, 2016 18:24 |
|
The constraint on `Point2D` is useless. Either do code:
code:
|
# ? Mar 14, 2016 18:26 |
|
Steve French posted:Thank you, this was my point, not the arrow syntactic sugar. Someone implied that there wasn't really a better alternative for the Java version, and the Scala makes it clear that with tuples and varargs there's a cleaner alternative. I implied there wasn't a better alternative in Java, for which an example in another language isn't really contrary evidence.
|
# ? Mar 14, 2016 18:30 |
|
Using tuples doesn't do anything to defeat "strong" typing but it's good to avoid consuming or producing tuples in public methods. Any language with type aliases will let you document the intended meaning of a tuple.
|
# ? Mar 14, 2016 18:33 |
|
Internet Janitor posted:Tuple types have always struck me as a bad idea because to some extent they defeat strong typing. A set of 2d cartesian coordinates, 2d polar coordinates, the dimensions of a rectangle or a complex number can all be represented with a pair of floats, but they have distinct semantic meanings and are not necessarily interchangeable. In a weakly-typed language I guess this is a moot issue. Tuple2[String, Int] is still strongly typed at both coordinates. If you want an Imag class that has two float value members re and im you should probably be creating a separate class for that along with its own arithmatic operator overloads. On the other hand, if I want to zip two lists, I shouldn't need to define a new type for the product.
|
# ? Mar 15, 2016 05:19 |
|
Subjunctive posted:I implied there wasn't a better alternative in Java, for which an example in another language isn't really contrary evidence. I wasn't so much arguing against your point; that said, my thought on the initial post was just as much "look at what the Java language made this library do" as much as "look at this terrible thing this library does". Additionally, given the fact that it is the standard library, I think it fairly reasonable to consider the associated language itself to be fair game. Especially considering that the only thing holding back the Map interface in this case from having a much more reasonable interface like the Scala one I Iinked to (not that the Scala collections library doesn't have it's own problems), is the lack of a compact syntax for tuples/pairs. I linked the Scala Map interface with that implication: it's totally feasible for Java to have a very similar interface, but it doesn't. You're right that if viewed purely from the standpoint of someone implementing a Map class that has no control over the features provided by the Java language, my Scala example would not really have been contrary evidence. But it wasn't. If it were a link to a Guava class or something, and not the JDK, it would be a different story; I think the standard library is a bit of a special case.
|
# ? Mar 15, 2016 07:30 |
|
code:
|
# ? Mar 15, 2016 16:27 |
|
I would expect that to not compile. Are private variables in java always actually a weird per-subclass variable, or is that just stupid magic for anonymous classes? Both alternatives seem terrible.
|
# ? Mar 15, 2016 17:36 |
|
Plorkyeran posted:I would expect that to not compile. Are private variables in java always actually a weird per-subclass variable, or is that just stupid magic for anonymous classes? Both alternatives seem terrible. IIRC weird per-subclass.
|
# ? Mar 15, 2016 17:43 |
|
Plorkyeran posted:I would expect that to not compile. Are private variables in java always actually a weird per-subclass variable, or is that just stupid magic for anonymous classes? Both alternatives seem terrible. The overriding modify sees the protected variable in class it is overriding (b in the new instance), but also all the variables in scope where the anonymous class is defined, that is, original.a and original.b. As "a" in new instance is invisible to overriding class, it ends up modifying original.a which it sees. It could also read all effectively final local variables in enclosing function, but not write to them... There are ways to make it clearer, or not to compile. code:
code:
|
# ? Mar 15, 2016 17:50 |
|
In a nutshell, Java's methods are polymorphic but its member variables are not. And yeah, it is a horror.
|
# ? Mar 15, 2016 17:57 |
|
On top of that, Eclipse can generate "bridge" code that make it so stuff outside of nested classes can use private members inside them. It usually doesn't affect anything, though, so you can tell Eclipse to shut up about it.
|
# ? Mar 15, 2016 18:12 |
|
betalarmannen posted:The overriding modify sees the protected variable in class it is overriding (b in the new instance), but also all the variables in scope where the anonymous class is defined, that is, original.a and original.b. As "a" in new instance is invisible to overriding class, it ends up modifying original.a which it sees. It could also read all effectively final local variables in enclosing function, but not write to them...
|
# ? Mar 15, 2016 18:44 |
|
A co-worker observed there was a DNS caching issue with Kafka:quote:So, we could rewrite Kafka in a different language. My personal suggestion is php...
|
# ? Mar 17, 2016 00:56 |
|
baquerd posted:A co-worker observed there was a DNS caching issue with Kafka: And that's why he had to die!
|
# ? Mar 17, 2016 01:08 |
|
PHP is certainly the most Kafkaesque language.
|
# ? Mar 17, 2016 02:03 |
|
baquerd posted:A co-worker observed there was a DNS caching issue with Kafka: Kafka is Java, right? Is it Kafka explicitly caching it or is it the JVM? If you're having the problem I think you are, it's not Kafka per se, more the JVM being dogshit. networkaddress.cache.ttl needs to be set to a positive value. IIRC, you need to plop that into $JAVA_HOME/jre/lib/security/java.security or something.
|
# ? Mar 17, 2016 05:31 |
|
why would wholly rewriting kafka even be a thought you have so many options before that, including taking the kafka source, fixing your issue, and not telling anyone else about it.
|
# ? Mar 17, 2016 06:21 |
|
FamDav posted:why would wholly rewriting kafka even be a thought Because you can do it better, duh! I mean, how hard could it be, it's just taking some data and doing something with it, right??
|
# ? Mar 17, 2016 06:38 |
|
piratepilates posted:Because you can do it better, duh! The less we think about it, the simpler it becomes!
|
# ? Mar 17, 2016 07:47 |
|
Sinestro posted:
Distance only works if x1 or x2 is 0 and y1 or y2 is 0?
|
# ? Mar 17, 2016 10:27 |
|
betalarmannen posted:
I haven't used Java for a few years so I'm a bit rusty... what does the createOverridingVersion() method actually do? Is that returning a new VisibilityDemo() instance, but with the modify() method overriden? So you essentially end up with two objects, ostensibly of the same type, but one with a differently behaving modify()? It seems crazy that you can even do that.
|
# ? Mar 17, 2016 10:42 |
|
chippy posted:I haven't used Java for a few years so I'm a bit rusty... what does the createOverridingVersion() method actually do? Is that returning a new VisibilityDemo() instance, but with the modify() method overriden? So you essentially end up with two objects, ostensibly of the same type, but one with a differently behaving modify()? It seems crazy that you can even do that. code:
|
# ? Mar 17, 2016 11:02 |
|
Right, ok. I didn't realise it was anonymous, I guess it was the 'return new VisibilityDemo()' that confused me.
|
# ? Mar 17, 2016 11:47 |
|
Ika posted:Distance only works if x1 or x2 is 0 and y1 or y2 is 0? What?
|
# ? Mar 17, 2016 14:36 |
|
HappyHippo posted:What? pre:distance (Point2D x1 y1) (Point2D x2 y2) = sqrt $ (x1 + x2)^2 + (y1 + y2)^2
|
# ? Mar 17, 2016 14:42 |
|
Winter Stormer posted:
Oh, right
|
# ? Mar 17, 2016 14:47 |
|
Came across this discussion on Twitter about removing issues from github and forcing everything to be a PR instead: https://gist.github.com/ryanflorence/8a62abea562ca2896dee I mean it's an interesting idea and I see why they would like to do it, but it feels like boasting that the amount of negative feedback about your project had gone down after you removed the feedback form from your site.
|
# ? Mar 17, 2016 20:26 |
|
Ryan Florence posted:This isn't a rigorous statistic, but I'm pretty sure these are 99% of the issues on Github. Save yer self-preening quips for the conference stages, Ryan. piratepilates posted:I mean it's an interesting idea and I see why they would like to do it, but it feels like boasting that the amount of negative feedback about your project had gone down after you removed the feedback form from your site. Exactly.
|
# ? Mar 17, 2016 20:36 |
|
Ika posted:Distance only works if x1 or x2 is 0 and y1 or y2 is 0? Amazingly the code I wrote while waiting in a line for coffee isn't perfectly correct.
|
# ? Mar 17, 2016 20:42 |
|
|
# ? May 28, 2024 23:13 |
|
I too want to install gates to further restrict feedback when at best a couple percent of everyone who's ever cloned the repo will bother to try and report an issue. Most people are going to be all "compile failed? pfft rm -rf and move on to the next option."
|
# ? Mar 17, 2016 20:45 |