@system blocks and safer @trusted (ST) functions

Steven Schveighoffer schveiguy at gmail.com
Wed Jul 28 11:12:14 UTC 2021


On Monday, 26 July 2021 at 18:59:45 UTC, Paul Backus wrote:
> The difference between POSIX `read` and `favoriteNumber` is 
> that you *can* read the source code of `favoriteNumber`. It's 
> literally right there, in the same module. That's the entire 
> reason why you can be certain it returns `42`.
>
> If `favoriteNumber` and `favoriteElement` were in different 
> modules, your argument would be correct, because 
> `favoriteElement` could no longer be certain about which 
> version of `favoriteNumber` it was calling.

If you consider the source to be the spec, then that contradicts 
your earlier suggestion that `favoriteNumber` can be changed -- 
its source is the spec, so changing the source to return 
something other than 42 will violate the spec.

If you consider the source to be the spec *and* you think 
changing the spec at will is OK, then we have different 
philosophies on what a code review and "good software" means.

-Steve


More information about the Digitalmars-d mailing list