3 ms·
> At this point, it seems clear to me we’ve just poorly designed our function. It solely exists to clamp numbers, so why would we accept strings? To me it soun
by sebtron 1y ago
> At this point, it seems clear to me we’ve just poorly designed our function. It solely exists to clamp numbers, so why would we accept strings?
To me it sounds like you are using a poorly-designed language
- nenenejej 1y agoYes. Go for example doesnt need an is-nunber, nor do you need to worry about if a validation throws an exception and unwinds your call stack (or not)
- quotemstr 1y ago> To me it sounds like you are using a poorly-designed language Not language specific. A C example that comes to mind is checking every non-nullable pointer parameter in every function for NULL and reporting an error instead of just letting the program crash. (Please, don't do that: just let contract violations produce crashes.) The article's author describes a problem of experience and spirit, not a language wart.
- Turskarama 1y agoLet me blow your mind for a second: this problem is not insurmountable in language design, C is not a perfect language, and nulls are bad design.
- hnlmorg 1y agoBut the problem is literally a direct result of language wart. The nullable pointer you’ve given is another great example of language wart. And one that’s often highlighted as a specific criticism against Go lang.
- quotemstr 1y agoNo, the problem is a result of sloppy thinking --- or no thinking --- about function contracts.
- hnlmorg 1y agoHumans error. The point of programming languages is to provide an abstraction to make development faster and less error prone than writing stuff in lower level languages or even assembly. If your language requires you to manually track function contracts then that’s a problem with the language itself. Not the developer.
- ModernMech 1y agoIndeed, you've pointed out a second language in the class of "poorly-designed languages"
- whatevaa 1y agoC crashes with worst possible error, equivalent of "Something went wrong". Good luck debugging. Only core dumps reveal more information.
- quotemstr 1y agoNothing beats the old Unix tools. From https://www.gnu.org/fun/jokes/ed-msg.en.html https://www.gnu.org/fun/jokes/ed-msg.en.html " golem$ ed ? help ? ? ? quit ? exit ? bye ? hello? ? eat flaming death ? ^C ? ^C ? ^D ? Note the consistent user interface and error reportage. Ed is generous enough to flag errors, yet prudent enough not to overwhelm the novice with verbosity."
- mrweasel 1y agoCan you point to a language that's doesn't have poorly designed aspects to it?