A Philosophy of Software Design
Walter Bright
newshound2 at digitalmars.com
Sun May 24 21:32:31 UTC 2026
On 5/23/2026 11:18 PM, Richard (Rikki) Andrew Cattermole wrote:
> In this particular case, the ideas presented in those books haven't evolved
> since then.
See the book I suggested, "A Philosophy of Software Design", which shows an
evolved understanding.
> TLDR: exceptions and replacement characters are both nominal approaches in
> Unicode handling.
I cannot say I automatically accept programming advice from the Unicode people.
After all, they invented normalized code points, an astonishingly bad idea. I've
never encountered anyone able to defend it beyond 2 rounds.
>> The first problem is you cannot use any string code in Phobos without
>> supporting exceptions and memory allocations. The second problem is throwing
>> an exception is the wrong solution.
>
> It is not necessarily the wrong decision, which is why its so predominant.
It was the wrong decision. Even Andrei came around on this, to his great credit.
> We have had trouble with it sure, and we would like to change it. But the
> problem domain does suggest it /can/ be the right choice. Even if I personally
> wouldn't do it with exceptions. There are some very nice boundaries in the
> algorithms and plenty of opportunities for specialization of functions including
> of decoding for specific error handling requirements.
I'm not convinced. I've never found any utility in generating exceptions on
Unicode decoding.
> If that exception is escaping the editor component rendering and causing the
> program to crash, that is a MAJOR BUG. Exceptions are supposed to be caught and
> handled much more locally in components like this, if there is potential for
> them to be thrown. Under no circumstances should that exception impact the user
> beyond a error alert. You should try Intellij out some time, sadly the D plugin
> still produces exceptions but yet its still quite functional. When applications
> are written properly, they handle exceptions gracefully and don't just fail at
> the first bad input.
Yes, you can write Exception handling correctly and it will behave as required.
But that's not the point. The point is it is an over-complication and exposes
dirty laundry when trying to encapsulate the functionality of a module.
> I considered it, but the $70 price tag ended that thought process beyond adding
> to a wish list lol.
$9.99 for the Kindle version. $22.95 for paperback.
More information about the Digitalmars-d
mailing list