News for hackers. Stuff that matters.
Re:Programming Is Hard by behnamoh on Wednesday September 20, 2023 @12:40AM (#37580439)
> which is 100% bug free

define "bug free". In Python, I've been reimplementing monads recently. It's such a shame that Python still doesn't have Null/None propagation. After each obtained result and before using it in the next chain, I have to run a series of sanity checks (is it Null or not, etc.) which should be resolved automatically by the language. Alas, most people don't care.

Re:Programming Is Hard by unnouinceput on Wednesday September 20, 2023 @02:14AM (#37580937)
Something like that would fail the code review at any large organization. Why? Because ternary operator is hard for maintenance purposes so the reviewer would simply ask to use if..else syntax instead. I gather you never worked in such organization.
Re:Programming Is Hard by thewakalix on Wednesday September 20, 2023 @02:37AM (#37581097)
That is not the ternary operator.
Re:Programming Is Hard by wruza on Wednesday September 20, 2023 @02:48AM (#37581149)
But following the setting of the gp comment, that operator would fail code review as well. Because the book of sacred rituals says so.
Re:Programming Is Hard by paganel on Wednesday September 20, 2023 @02:33AM (#37581059)
Not the OP and not a fan of ternary operations, but if programming were left to large organizations we would still be writing .asp pages.

Which is to say that inovation happens only when you try to do stuff just a little different each time, so I’d say that code reviews as currently implemented at those big organizations is against long-term programming-related innovation.

Re:Programming Is Hard by benrutter on Wednesday September 20, 2023 @07:37AM (#37582933)
This is an interesting idea- I'm not sure I understand it fully though. Do you have much luck with static type analysis? I find in Python, nothings ever certain, but mypy with good type hints solves a lot of these kind of None based shenanigans.
Re:Programming Is Hard by behnamoh on Wednesday September 20, 2023 @09:49AM (#37584079)
I have heard about mypy but haven't seriously used it. Type hinting has helped a lot (basically you'll end up writing Python like it's Rust), but something like the Maybe monad (my example above) would reduce a lot of boilerplate.