News for hackers. Stuff that matters.

hepta

Doesn't seem like valid JS, you wouldn't need mark.js if that were the case.
Re:Effective Programs: 10 Years of Clojure on Tuesday October 31, 2017 @12:09PM (#15594289)
Maybe we have to dig into the specifics: there's a lot of things that can be done with Name, regardless of where the name belongs, is that what you mean? If so, most typed languages let you say that Person can be a thing with a Name. I don't have Clojure experience so we might be talking past each other here.
Re:Effective Programs: 10 Years of Clojure on Tuesday October 31, 2017 @11:31AM (#15593950)
I do agree that there are problems where the "maps of facts" approach is better suited than ADTs. I'm not sure if those are the majority of problems we're solving. You can still do all that in a typed language, using dictionaries. You can be as precise as you want. In some sense you lose that without a type-checker.

I only have my experience (which is about 1/4 of his) to lean on. And I've only had problems when protocols are not well understood by all parties, never the opposite. Talking in the level of ADTs (or some representation that is equally precise) tends to either clear things up, or uncover problems that were not obvious in informal discussion.

Re:Diminishing returns of static typing on Tuesday October 03, 2017 @12:12PM (#15393474)
There is code that doesn't `constantly cast ti and from Object`, most code won't need to, anyway. Generic information is kept during type-checking and then is discarded, this can be considered an optimization. There are some warts that appear because of erasure, but I believe you're wrong in implying that most developers care (most java developers, maybe scala peole have more issues because of erasure).
Re:Code Smells: Iteration on Friday August 25, 2017 @02:15PM (#15100832)
> The only down side is removed compatibility with other languages like C and C++ and C#, locking in the app to a specific language more.

Using a Stream instead of a for loop does very little to make your code incompatible with C. It is already pretty much incompatible (modulo JNI).

What I mean is: if you want something that looks like C just use that, there is no gain in not learning new constructs just because older languages did not have them.

I imagine there is a way to raise a cow for beef that I find ethical. I don't know if you can do so for dairy cows. As far as I know, the cow has to have young to lactate, meaning it must be impregnated frequently. Am I wrong?

This is in constrast with chicken eggs, which I believe can be ethically produced (even though they aren't in the large majority of the industry).

Re:ReactOS 0.4.5 Released on Sunday May 28, 2017 @10:18AM (#14434449)
Yeah, I'd like to know what the experience is for people who use it regularly.
Re:Pattern Matching for Java on Thursday April 20, 2017 @07:51AM (#14155820)
I already use vavr, sadly such pattern matching is not exhaustive, which is the most important feature for me.
Re:Pattern Matching for Java on Thursday April 20, 2017 @06:32AM (#14155475)
I think both are not exhaustive (or don't have exhaustiveness enforced by the compiler).
Re:Problems with Kotlin on Wednesday March 15, 2017 @05:22PM (#13879906)
This seems like nitpicking as well. If the intention is that everything is an expression (that seems to be it, to me) then you have to have a Unit, no mater what you call it. I'd rather have a name that 3 academics know than override a distinct concept (Void) or make something entirely new.
Re:The State of Go on Sunday February 05, 2017 @11:24AM (#13573045)
What are your problems with spring boot? What bloat are you referring to?
Re:A practical introduction to functional programming (2013) on Monday December 26, 2016 @05:48AM (#13257796)
> Maybe passing around a random generator explicitly is not what we want.

That's fair. What I often want is to pull a function out of my program and test it without a lot of work. This is easy if the function is pure.

> My point is that hidden state is not bad when the explicit simulation of state is cumbersome to use.

That depends on your goal. If your intention is to make state explicit, then by definition there has to be more code to make it so. Again, a preferable abstraction for this makes the boilerplate go away, while keeping everything pure. That added effort gives you testability but I know there are instances where that effort is not worth it.

Re:A practical introduction to functional programming (2013) on Sunday December 25, 2016 @10:30AM (#13254347)
You use a generator that receives a state and returns a random number and the modified state. You'd want some additional abstractions to make that work well.
Re:A practical introduction to functional programming (2013) on Sunday December 25, 2016 @07:43AM (#13253935)
> That's the risk of reading articles like the OP, where they show you a couple functional tricks in an imperative language that inherently can't give you the whole picture.

The other risk is that people (like me, a few years ago) are sufficiently convinced by these simple loop examples that they decide to apply them. This might (or might not) lead to greater functional aspirations which make "whole picture" much more interesting. You might get to free monads, but not before you've used a fold on a list.

Re:Seven years of Go on Thursday November 10, 2016 @02:49PM (#12923600)
If you're already proficient in Java/JVM I personally don't see a lot of reasons to use Go. Maybe for extremely small services or if you can't take the higher memory requirements.
Re:The advantages of static typing, simply stated on Saturday September 17, 2016 @10:50AM (#12520705)
It relates to typing as a method of encoding invariants, yes. I was trying to say that it is unrelated to which "type" of typing. That is, I can perfectly imagine a statically typed language where you could encode such restrictions as easily as you do with Elixir and you would get the same result, a runtime error.

Regarding your rating example, you could encode that restriction in a type (or class in OO) and have a guarantee that once you have an instance of that type you no longer need to check for it's validity. Rendering a Rating would never fail at runtime, you'd get a type error first.

Re:The advantages of static typing, simply stated on Friday September 16, 2016 @01:39PM (#12515764)
Even though that may be factually correct, it doesn't seem to be related to static typing. Haskell has guards but they are slightly different.
Re:Advantages of Functional Programming in Java 8 on Tuesday September 06, 2016 @06:53AM (#12435005)
Depends on your goals, Java isn't the best if your aim is to learn FP.
Re:Advantages of Functional Programming in Java 8 on Tuesday September 06, 2016 @06:50AM (#12434991)
I see now, probably just something to do with formatting/escaping, the <> are being swallowed.

Yes, it's strange. I'd prefer to map a null in a DTO to an empty optional. I'd like even more to never have nulls in the dto in the first place.

Re:Advantages of Functional Programming in Java 8 on Tuesday September 06, 2016 @06:10AM (#12434795)
I assumed the omission was for brevity, but there are annotations and 'final' in a lot of places.

Similarly, methods for mutation (compulsory, no less!) are red flag in FP.

Re:Dotty: a next generation compiler for Scala on Wednesday June 22, 2016 @09:45AM (#11953820)
Interop with Java seems unlikely unless they keep a JVM tucked away somewhere.
Re:Fish Have Feelings Too on Tuesday June 21, 2016 @03:58AM (#11944176)
It's a difficult line to place, for instance is pain avoidance plus memory enough? If I imagine a fish thinking "I can't do that again" that certainly looks like sentience, but the resulting behavior (avoidance) can occur without sentience, it seems.

Is something like that been demonstrated in other animals?

Re:Java Generics Are Turing Complete on Thursday May 26, 2016 @11:09AM (#11778493)
You don't need to be a good chef to know a meal is awful. A lot of people use the language (me included) and make it work, doesn't mean it's without fault.
In what ways is this different from ECS? It's strange to me that you can do the same thing in slightly different ways.
My god, I feel much better with my puny abuse.
Re:Deprecating: java.util.Optional.get()? on Thursday April 28, 2016 @11:26AM (#11589549)
The point (or the reason why I use it) is to express the possibility of absent values, same as Rust, Haskell, etc. That the language let's you have null references is another (bigger) problem.
Re:Some Rookie Mistakes in Go on Thursday March 24, 2016 @05:17AM (#11351471)
That's not what I meant. My reply to you needs the context of the parent comment.

To "miss the known universe" was the explicit purpose of the designers. It was supposed to be simple (whether their definition is good or not is debatable). The number of users is irrelevant.

Re:NPM and Left-Pad: Have We Forgotten How to Program? on Wednesday March 23, 2016 @07:24PM (#11349201)
What if lodash itself was unpublished? I'm having a hard time drawing a line here, obviously a 10 line function is too far on the bad side of lazy, but I can't tell what is an acceptable dependency.
Re:Some Rookie Mistakes in Go on Saturday March 19, 2016 @08:09PM (#11321135)
It might be that the designers chose to focus on specific problems they found at Google, universe be damned. Maybe Go is just a good Google language.
Wait a minute, is this a troll post? Interfaces? I get the tooling, maybe, and CSP out of the box, I don't understand what's great about Go's interfaces (compared to plain old boring Java, for instance).

Older »