Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^13: Modernizing the Postmodern Language?

by chromatic (Archbishop)
on Jul 07, 2020 at 17:45 UTC ( #11119009=note: print w/replies, xml ) Need Help??


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

Can they be rewritten? Yes. It's just code.

Replacing XS is a big deal though. That's a bigger break than syntax, because 30% of the CPAN won't work with new releases.

Nicholas Clark's Ponie work shows one way where it's difficult. Artur Bergman ran an experiment around the same time to migrate SVs to something more like Parrot's PMCs, where every data type had virtual methods in well-defined slots instead of accessor macros. That didn't go very far either. These are fundamental assumptions of perl's implementation without any encapsulation beyond C macros.

It'll be a lot of work.

The best way I've ever figured out to do this is to introduce an abstraction layer for XS that's not XS and that lets the core gradually migrate away from the XS-ish implementation, but even that's a decades-long project I fear.

Replies are listed 'Best First'.
Re^14: Modernizing the Postmodern Language?
by LanX (Cardinal) on Jul 08, 2020 at 16:47 UTC
    > PMCs, where every data type had virtual methods in well-defined slots instead of accessor macros

    Well my first idea was, why not write a wrapper macro/class which applies the accessor macros in form of "virtual methods in well-defined slots"?

    > The best way I've ever figured out to do this is to introduce an abstraction layer for XS that's not XS

    Are you going into the same direction here?

    Why would we need to gradually migrate away from XS then?

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery

    UPDATE s/CS/XS/ typo

      Well my first idea was, why not write a wrapper macro/class which applies the accessor macros in form of "virtual methods in well-defined slots"?

      It's been a long time since I thought about such a thing, but I don't know how much work it would be to write lvalue macros that could call set_ methods appropriately.

      Why would we need to gradually migrate away from XS then?

      CPAN/DarkPAN authors who want to support multiple language versions with a single release.

        > CPAN/DarkPAN authors who want to support multiple language versions with a single release.

        Maybe a misunderstanding:

        Are you talking about migrating away from the

        • XS API or
        • XS implementation?

        If such a wrapper was implemented as linkable library in XS, why would one need to write differently for various Perl versions?

        (Disclaimer my $XS_know_how ~~ 0

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

        °) dumbmatch operator ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11119009]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2020-09-22 17:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I don’t succeed, I …










    Results (129 votes). Check out past polls.

    Notices?