Exception handling

Moritz Maxeiner via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jul 14 16:50:25 PDT 2017


On Friday, 14 July 2017 at 23:09:23 UTC, Stefan Koch wrote:
> On Friday, 14 July 2017 at 23:02:24 UTC, Moritz Maxeiner wrote:
>> On Friday, 14 July 2017 at 21:20:29 UTC, Jonathan M Davis 
>> wrote:
>>> Basically, the  compiler _never_ looks at the bodies of other 
>>> functions when determining which attributes apply. It always 
>>> [...].
>>
>> I'm well aware of that, but it doesn't mean that it can't be 
>> enhanced to do so (i.e. what it can do, not what it does do).
>
> "Enhancing" the compiler to do so comes at a very very high 
> cost.

That depends on if, how, and when the compiler frontend currently 
does other (unrelated to exceptions) semantic analysis of 
function bodies.

> Which would force the compiler to look at every body it can 
> look at to maybe discover a closed set of execptions. This 
> would kill fast compile-times!

Again, this depends on the exact internals available at the 
semantic analysis time, but in theory, it should be possible that 
when a ThrowStatement is encountered, the surrounding scope 
aggregates the exception's type in it's aggregated exception set 
(ignoring things not inherited from Exception).
I don't think this would necessarily kill fast compile times.


More information about the Digitalmars-d-learn mailing list