News for hackers. Stuff that matters.
Re:Want cleaner code? Use the rule of six by samtheprogram on Saturday September 24, 2022 @04:41PM (#32966379)
Just because it’s a different syntax than you’re used to reading in another language doesn’t make it ugly. If you’re used to reading it and work in the language regularly, it actually looks quite clean.

This sounds like a Windows user who can’t stand macOS because they don’t know where anything is.

Your post downvote edit assumes your opinion here is objective. It isn’t.

Re:Want cleaner code? Use the rule of six by tomlin on Saturday September 24, 2022 @11:31PM (#32968693)
Parentheses as pipes is what you do when you’ve backed yourself into a corner.

Ruby has decided (for some reason?) to use two ways to declare.

Function(param, param)

and

{ |param, param| }

why? What is a good reason for this?

It would be an anti pattern in design, not sure why Ruby gets a special hall pass.

Re:Want cleaner code? Use the rule of six by klibertp on Sunday September 25, 2022 @09:56AM (#32971370)

   collect: [ :keyAndValue | (keyAndValue splitAt: '=') last ].
is why.

EDIT: (it's been a few months since I used it, so I) made a mistake in the syntax (declared local variable instead of a formal block argument), it's fixed now.

Re:Want cleaner code? Use the rule of six by tomlin on Sunday September 25, 2022 @10:03AM (#32971426)
You might as well have leaned on the keyboard, it wouldn’t look much different. This is not readable code.
[dead]
[dead]
[dead]
Re:Want cleaner code? Use the rule of six by dang on Thursday September 29, 2022 @02:07PM (#33024799)
Posting like this will get you banned on HN, regardless of how right you are or feel you are. Please review the site guidelines (https://news.ycombinator.com/newsguidelines.html) and please don't post like this to HN again.

This is particularly important when your argument happens to be a good one, because in that case you're discrediting the truth by posting abusively (see https://hn.algolia.com/?dateRange=all&page=0&prefix=true&sor... for past explanations of this point). That hurts everyone. It particularly hurts those of us who happen to agree with your view (me, for example—I haven't read much of this thread but I'm pretty sure I've made similar arguments about readability in the past).

Re:Want cleaner code? Use the rule of six by tomlin on Thursday September 29, 2022 @08:13AM (#33019464)
I don’t know Russian. Your point doesn’t line up with the topic at all. I know Ruby. I still think it’s unreadable. Can you try next time?

  I feel incredibly sorry for the poor kids you teach. They will be suffering aftereffects for the rest of their lives.
I feel bad that your account hasn’t been flagged for your behaviour on here. For someone who thinks they understand Ruby so well, you certainly haven’t taken any time to understand the rules. Personal attacks? Really? You just showed your cards. Weak arguments are followed with weak ad hominem.

It’s not just me, no one is teaching Ruby to kids because it’s not a good language for readability. Take it up with all of the teachers who see it just as I do.

Re:Want cleaner code? Use the rule of six by dang on Thursday September 29, 2022 @02:07PM (#33024800)
Please don't respond to a bad comment by breaking the site guidelines yourself. That only makes everything worse.

https://news.ycombinator.com/newsguidelines.html