Why exceptions for error handling is so important

via Digitalmars-d digitalmars-d at puremagic.com
Mon Jan 12 15:33:12 PST 2015


On Monday, 12 January 2015 at 23:18:52 UTC, bearophile wrote:
> I don't agree. The basic ideas of STL by Alexander Stepanov are 
> very good. Phobos contains related ideas, repackaged in ranges. 
> Ranges are a little more fundamental, ma but in practice they 
> are often good enough and they are often more handy. Rust has 
> chosen a different way so far, but will improve with higher 
> order generics later.

I've tried to like STL for 17 years, and whenever speed and clear 
programming matters it is basically a good idea to throw it out. 
It goes like this: 1. code up prototype with STL, 2. write STL 
code and add the features I need, 3. being annoyed by the bloat 
and noise, 4. rewrite code with my own container for log2 
efficiency and ease of use...

I wish Phobos would have stuck to the term "iterators" used in 
GoF since a "range" usually is something else... but digressions 
aside. Phobos is kinda like the "functional" parts of Python. The 
downside there is that you need to remember lots of verbs. A 
solution like list comprehensions is a lot easier on the 
programmer, if convenience is the goal.

But in system level programming efficiency is the goal. That 
means log2 sizes, operations that are optimized for log2 sizes, 
datastructures that are optimized for SIMD. Phobos "ranges" need 
a next_simd() to be efficient. Right?



More information about the Digitalmars-d mailing list