Comparing Exceptions and Errors

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Jun 6 18:08:17 UTC 2022


On Monday, 6 June 2022 at 17:52:12 UTC, Steven Schveighoffer 
wrote:
> Then that's part of the algorithm. You can use an Exception, 
> and then handle the exception by calling the real sort. If in 
> the future, you decide that it can properly sort with that 
> improvement, you remove the Exception.
>
> That is different from e.g. using a proven algorithm, like 
> quicksort, but failing to implement it properly.

No? Why do you find it so? Adding a buggy optimization is exactly 
failing to implement it properly. There is a reference, the 
optimization should work exactly like the reference, but didn't.

Using asserts in @safe code should be no different than using 
asserts in Python code.

Python code <=> safe D code.

Python library implemented in C <=> trusted D code.

There is no reason for D to undercut users of @safe code. If 
anything D should try to use @safe to provide benefits that C++ 
users don't get.





More information about the Digitalmars-d-learn mailing list