opDispatch, duck typing, and error messages

Jonathan M Davis jmdavisProg at gmx.com
Sat Apr 23 16:39:16 PDT 2011


> On 2011-04-22 01:54, Jonathan M Davis wrote:
> >> Jonathan M Davis wrote:
> >>> I just checked. Exception _does_ take a default file and line number.
> >> 
> >> Huh, maybe my dmd is getting old.
> >> 
> >> Maybe we should revisit this after the next dmd release. Sounds like
> >> one is coming pretty soon with a lot of yummy goodness in it. All
> >> of this Exception stuff may be moot.
> > 
> > It was in dmd 2.052. I don't know when the change was made though. I
> > might have been the one to change it too. I made several changes a while
> > back to make it so that Exception and Error types had default file and
> > line numbers (and I actually had to remove several on various Errors,
> > because the way that they're actually created makes them not work with
> > default arguments).
> > 
> > - Jonathan M Davis
> 
> It would nice to have file and line info available on Mac OS X as well.

Whether there is file and line info with an exception should have nothing to 
do with the OS, except perhaps in some low-level stuff that druntime does, but 
I don't think that it makes a difference even then. Pretty much anything and 
everything derived from Exception should give a file and line number - 
generally that file and line number are the point where the exception was 
thrown from. Many Errors _can't_ have proper file and line numbers due to how 
they're thrown, though some of them (such as AssertError) should have proper 
file and line numbers.

So, I don't know why you wouldn't be seeing file and line numbers on Mac OS X. 
It should be the same as the other OSes. Stack traces are another issue (and I 
have no idea if Mac OS X currenly has them), but the behavior with regards to 
file and line numbers in exceptions should be the same for all OSes. I don't 
know why they wouldn't be.

- Jonathan M Davis


More information about the Digitalmars-d mailing list