Is it time for D 3.0?
H. S. Teoh
hsteoh at quickfur.ath.cx
Sat Mar 28 00:17:52 UTC 2020
On Fri, Mar 27, 2020 at 11:40:35PM +0000, Adam D. Ruppe via Digitalmars-d wrote:
> On Friday, 27 March 2020 at 22:47:36 UTC, H. S. Teoh wrote:
> > The point is, these are all implementation details that can be
> > implemented in a way that's transparent to user code. It doesn't
> > have to be libunwind with its associated overhead that Walter did
> > not like.
>
> It used to be this way! D had a custom exception mechanism (on linux,
> on Windows it used SEH which works very well) that was quite
> lightweight, but it got killed in the name of C++ compatibility :(
Hmm. Then maybe we should make this an optional thing so that projects
that don't need C++ compatibility don't have to suffer for it?
Either that, or do the translation at the C++/D boundary only, instead
of throughout the entire call stack. Basically:
1) A D function declared extern(C++) would throw a libunwind compatible
exception in its exit block if it had caught a D-specific exception.
2) A D function that calls an extern(C++) function would insert a
libunwind-compatible catch block that translates any thrown C++
exception into the D-specific implementation, then continues propagating
it as before (including to any user-defined catch blocks if the user
wrote one in the function).
So we only need to pay if C++ compatibility was actually used, rather
than pessimize all D code just on the off-chance that C++ compatibility
*might* be required.
T
--
People say I'm indecisive, but I'm not sure about that. -- YHL, CONLANG
More information about the Digitalmars-d
mailing list