Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Generally direct refutation of a central point is a constructive argument. Here’s another example of direct refutation:

You’ve given a strawman argument, specifically you’ve given one implementation which has abstracted the details (we don’t see the code for take, select and reduce). That’s just an arbitrary decision you’ve made, the equiv go example you could have posted might be:

    // idiomatic error handling elided only for brevity
    first20, err := Take(nums, 20);
    odds, err := Select(first20, Odd);
    sum, err := Sum(odds);
You’ve presented these different levels of abstraction and then argued against a point that wasn’t made. A strawman argument.

In the interest of steelman-ing your argument, the interesting difference would be in the comparison of implementations of take() or select() or reduce() - but ruby is a dynamic language so there’s not really a comparison to be made.

We can still say how we might approach Take() or Select() or Reduce() or Sum() though if we need them to be generic over argument types - in the absolute worst case (so not using go generate to help us here or an interface or the new generics functionality) in the worst case e we would have repeated definitions of these functions. Code that any junior developer will be able to safely reason about and change. Code that has utterly obvious risks (you might introduce a differing behaviour in one implementation of Take() for example) - so obvious that it’s trivial to defend against with nothing more than generative testing. Again, painfully simple code. Zero cleverness. Any developer of any experience level can quickly make a valid change.



> Generally direct refutation of a central point is a constructive argument.

Selecting your own definition for a word and basing an argument around the definition you chose for it is not direct refutation of a central point. Again you appear to just want to play games where you get to declare yourself the Internet Argument Winner and pat yourself on the back instead of actually giving a shit about the perspectives of those who disagree with you.

> You’ve presented these different levels of abstraction and then argued against a point that wasn’t made. A strawman argument.

Those functions don't exist in go, and up until generics were just added, they couldn't be without copy/pasting their implementation for every single array type you wanted to implement them for. You're essentially making my point for me in that the only way these functions can be written now without resorting to copy/paste in every project that wants to use them is thanks to generics.

I presented this argument because it is a common refrain in the Go community that functional iterators like map, filter, reduce, and take are unnecessary and add complexity and are unnecessary. Far from a straw man, this is a direct example of a case where people have pleaded for generics while people like yourself have argued that it increases complexity. You can find examples of those types of perspectives right here in this comment section.

And this is just one example of an area where golang has historically foisted complexity onto its users rather than solve it internally.


>> Selecting your own definition for a word

Is that accurate? I said:

>> To complicate something is to combine and intertwine it with other concerns. To fold them together is to complicate them.

The dictionary defines complicate as:

>> to make complex, intricate, involved, or difficult

With etymology:

>> complicat- folded together complicate combine, entangle. intertwine earlv 17th century

>> instead of actually giving a shit about the perspectives of those who disagree with you

Now i resent that because i took the time to try and steelman your bad argument.

>> they couldn't be without copy/pasting their implementation for every single array type you wanted to implement them for

Not true, as i said there’s always been options for this:

>> if we need them to be generic over argument types - in the absolute worst case (so not using go generate to help us here or an interface…

Behind the scenes in the compiler, the syntactic sugar of generics are ultimately performing what you would do with “go generate“.

>> in every project that wants to use them

I don’t follow, why aren’t we allowed to create a library for code reuse like https://github.com/logic-building/functional-go/blob/master/... has done for example?


I think the code you linked shows exactly why generics are needed for these kinds of methods. By introducing a single generic, you could reduce it from 500 lines to 20, and make it work for all types, not just the built-in ones. It would also remove the need to have different method names.

I think that makes it less complex, as the developer doesn't need to think about the exact underlying type of the array when calling Take (which is irrelevant to its implementation).


>> By introducing a single generic, you could reduce it from 500 lines to 20

No one is writing 500 lines of code - just as when you use the generics syntax you don’t write the code that is generated by the compiler in response.

You could save about 10 lines, specifically these 10:

https://github.com/logic-building/functional-go/blob/master/...

You would still need the comparable ~40 lines of “generic” code:

https://github.com/logic-building/functional-go/blob/master/...


> in the worst case we would have repeated definitions of these functions. Code that any junior developer will be able to safely reason about and change

It's also code that many junior developers will forget to change in all the places when they fix a bug in one of them.


Yeah that’s what i was getting at with:

>> Code that has utterly obvious risks (you might introduce a differing behaviour in one implementation of Take() for example) - so obvious that it’s trivial to defend against with nothing more than generative testing.

Really obvious risks are usually easier to handle than more obscure ones.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: