in reply to Implementing named infix operators with parser hook?

Regarding your updates, the custom op stuff isn't what you want. It doesn't allow you to define your own infix operators. The custom op stuff is what Ref::Util::XS does to make its functions even faster.

Subs written in XS run faster than subs written in Perl; that's obvious. But subs written in XS still don't run as fast as Perl built-ins like ref. The custom op code stuff allows XS code to be called as efficiently as built-ins. It doesn't have anything to do with parsing, so won't let you define an infix operator.

Replies are listed 'Best First'.
Re^2: Implementing named infix operators with parser hook? (updated)
by LanX (Saint) on Aug 17, 2018 at 10:58 UTC
    Thanks :`(

    UPDATE

    I don't understand this wording though:

    This is primarily to allow the building of interpreters for other languages in the Perl core,

    Cheers Rolf
    (addicted to the Perl Programming Language :)
    Wikisyntax for the Monastery FootballPerl is like chess, only without the dice

      I don't know why it says that; I can't see how it's that useful for interpreting other languages. A couple of paragraphs further down it says:

      It's important to know what custom operators won't do for you. They won't let you add new syntax to Perl, directly. They won't even let you add new keywords, directly. In fact, they won't change the way Perl compiles a program at all.

      If you're building your own interpreter for another language into Perl, you'd first need to sort out the parsing. The custom op still would only be an optimization stage afterwards to enable the language's keywords to perform comparably to Perl's built-ins.

        Thanks, I will try to ask Reini next time I meet him, he might know what was meant.

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery FootballPerl is like chess, only without the dice