Re: Why do we test a build using g++?
[email protected] (Tony Cook) Mon, 13 Jul 2026 11:27:20 +1000
| Newsgroups | perl.perl5.porters |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Jul 04, 2026 at 04:44:47PM -0600, Karl Williamson via perl5-porters wrote: > I've harbored some ambitions to convert portions of the core to be written > in C++. > > Can someone explain why Topaz (which attempted something like this) failed > or post a link. > > Have events moved on so the languages are too disparate for this to be > feasible? The languages are used very differently. I do think some things could be done more simply if Perl were C++, I know you've come across a few cases where you've needed to mortalize an SV (AV, whatever) that you're planning on returning because something you call may throw an exception. If we used C++ you could use RAII to ensure the SV was released on an exception, and disarm that for the normal return path, vaguely like: // like std::unique_ptr unique_sv s = newAV(); ... stuff that might throw ... return s.release(); but RAII is incompatible with the way Perl handles exceptions - longjmp() bypassing such cleanup is undefined behaviour, and replacing setjmp()/longjmp() with C++ exceptions would break XS code that uses the older style exceptions. RAII is such a basic concept in C++ I don't see any point in changing to C++ without it. Tony