Why don't other programming languages have ranges?

Walter Bright newshound2 at digitalmars.com
Mon Jul 26 14:04:53 PDT 2010


retard wrote:
> Tue, 27 Jul 2010 04:10:14 +0800, KennyTM~ wrote:
> 
>> On Jul 27, 10 02:42, Walter Bright wrote:
>>> retard wrote:
>>>> I think the Java/C# developers gave up X % of the execution speed to
>>>> avoid hard crashes (exceptions instead of segfaults)
>>> 1. segfaults *are* exceptions.
>>>
>>> 2. D offers a memory safe subset, and D's ranges and algorithms are
>>> memory safe.
>> Catching exception is easy, but handling (segfault) signal is a mess.
> 
> Indeed, I'd like to know how you recover from a segfault without help 
> from an external processes.

On Windows, it's fairly straightforward. I did it once as part of a gc 
implementation that would mark unmodified pages as hardware readonly. It would 
catch the seg fault from writes to it, log the page as modified, make the page 
writable, and restart the failed instruction.


> Sometimes you know that some routine might 
> fail once in a week, but the program MUST run non-stop for several 
> months. In Java you can achieve this with exceptions. And you can also 
> dynamically fix classes with the class loader.

Any program that attempts to achieve reliability by "recovering" from program 
bugs and continuing is an extremely badly designed one.

http://www.drdobbs.com/blog/archives/2009/10/safe_systems_fr.html

http://www.drdobbs.com/blog/archives/2009/11/designing_safe.html

Sadly, it's a topic that has not penetrated software engineering instructional 
materials, and programmers have to learn it the hard way again and again.


More information about the Digitalmars-d mailing list