Hacker News new | ask | show | jobs
by mquander 5880 days ago
I think it only looks gross because they're methods on an object, and you're used to that meaning "imperative mutable thing." Compare this:

    employees.AsParallel().AsOrdered()
to the more-traditional-C-style

    MaintainOrder(Parallelize(employees))
or the admittedly more attractive

    (maintain-order (parallelize employees))
and suddenly it seems perfectly sensible. I thought it was ugly first, too, but now I'm used to it.
2 comments

How is

    (maintain-order (parallelize employees))
vs

    MaintainOrder(Parallelize(employees))
"admittedly more attractive"? I enjoy functional constructs, but now you're just talking syntax right?
I agree, this is a strange claim. On the other hand (as long as we are with Clojure), something like

  (->> employees parallelize maintain-order)
might be said to be more attractive because it looks more linear. The sequential order of application is thus maintained, and the parentheses which are perceived as additional levels of hierarchy are removed.

Of course, the dot-dot-dot style in Java/C#/etc is doing the same:

  employees.Parallelize().MaintainOrder() 
is also linear, the parentheses are only used to specify parameters.
I'm just being a smug weenie is all. Obviously there's not a real difference here. However, it's a better question as to whether this style or the "pipeline" style illustrated below and in the C# code is more pleasant.
I think one of the problems I have with it, is that AsParallel() doesn't seem to me like it should be a function. It should be an argument to a function. I dislike that.
Depends on perception. What about

    someFunction.Memoize();
That's perfectly natural, right? (I mean, you could claim that "is memoized or not" should be a "flag" on a function, but that's starting to sound a little silly to my ears.) It's exactly analogous.
Is it just the name? AsParallel versus ToParallel, for example?