http://qs321.pair.com?node_id=11118856


in reply to Re^3: Modernizing the Postmodern Language?
in thread Modernizing the Postmodern Language?

Well, perhaps we could have a Platypus XS-emulator? It will not be able to modify runtime internals, unless through an API, but the rest of XS code can be run independently of current internals. Right now (with my minimal understanding, hence the hand-waving) these internals are accessed via macros and global variables. Introduce a layer to isolate the internals: macros become functions, global variables access replaced with accessor functions. Better still, a Perl interpreter behaves like an object. It is no longer the "centre of the universe" (as https://perldoc.perl.org/perlxs.html#CAVEATS says) but it is controlled by a meta-interpreter. This way, and with an API in place for controlling and accessing interpreters, a meta-interpreter can spawn as many Perls and many different Perl versions. As long as they adhere to the API. For older Perl's a wrapper will be needed to provide this API.

Also, again with my minimal understanding, perhaps it will no longer be needed to use XS for performance but, instead, write algorithm in any Platypus-supported language and use Platypus to access it from Perl.

Here is a funny idea: statically link XS code with Perl-X.Y.Z libraries and access it via Platypus from any other Perl version. Essentially one runs two different perl versions one inside the other. Though, again, one can't control the internals and do the tricks.

edit: also relevant to this thread Re^2: Modernizing the Postmodern Language?.