@PythOnRails@programming.dev to Programming@programming.dev • 9 months ago"Useless syntax sugar": Numbered block parameters in Rubyzverok.spaceexternal-linkmessage-square22fedilinkarrow-up141arrow-down13cross-posted to: hackernews@derp.foo
arrow-up138arrow-down1external-link"Useless syntax sugar": Numbered block parameters in Rubyzverok.space@PythOnRails@programming.dev to Programming@programming.dev • 9 months agomessage-square22fedilinkcross-posted to: hackernews@derp.foo
minus-squareEager EaglelinkfedilinkEnglish2•edit-29 months ago The liberty to not name things that are obvious. and that’s yet another way to end up with hard to read code. Variables hold values that have meaning. Learn how to name things and you’ll write good code.
minus-square@exussum@lemmy.worldlinkfedilink1•9 months agoThis makes me want to write a function for you to add to numbers where the variables are leftumber and rightnumber, instead of x and y.
minus-square@exussum@lemmy.worldlinkfedilink1•9 months agoIn what way? If you encountered a function that had x and y which just added them together, that’s not readable enough?
minus-square@Miaoulink1•9 months agoWell in a vacuum yes sure, you’re right, but in practice there’s always some context. x and y could be referring to axes, where an addition makes little sense. However lhs and rhs make more sense if you’re overloading an operator
and that’s yet another way to end up with hard to read code.
Variables hold values that have meaning. Learn how to name things and you’ll write good code.
This makes me want to write a function for you to add to numbers where the variables are leftumber and rightnumber, instead of x and y.
Lhs and rhs are much better than x and y
In what way? If you encountered a function that had x and y which just added them together, that’s not readable enough?
Well in a vacuum yes sure, you’re right, but in practice there’s always some context. x and y could be referring to axes, where an addition makes little sense. However lhs and rhs make more sense if you’re overloading an operator