Re: About using rperl
by LanX (Sage) on Aug 13, 2019 at 09:41 UTC
|
I'm not an expert on rperl, but I think the answer to your third question should be obvious.
> Then, why not just write an XS-module?
XS modules are not easy to write. Being able to write high performance code in "pure" Perl should be an advantage.
| [reply] |
|
Yes I agree! It would be great to see an example of how to call a sub in the shared library from regular Perl code.
| [reply] [d/l] |
|
It would be great to see an example of how to call a sub in the shared library
I haven't seen such example of code, but I attended a talk by Will Braswell a few months ago, and asked whether it is feasible, and Will answered that it is possible. So you could have your CPU intensive nested loops or other computations in a RPerl module, and the rest in a regular Perl program. This looks very interesting to me, because it seems easier to write a RPerl module than an XS module.
| [reply] |
|
|
|
|
|
|
| [reply] |
Re: About using rperl
by dave_the_m (Monsignor) on Aug 13, 2019 at 11:26 UTC
|
As far as I can tell, RPerl is perl but with every feature which makes perl either useful or "perlish" removed.
Dave. | [reply] |
|
Yeah, I definitely get your point and I mostly agree. And I probably don't want to write a full RPerl application.
But if I could write my main program in Perl and have my limited CPU intensive part(s) of the code (e.g. deeply nested loops) in RPerl, maybe I could have the best of two worlds: high speed of compiled programs for the CPU intensive part, and the high expressive power of Perl for the rest of the program.
| [reply] |
|
I once agree with you, but now I don't. you think RPerl is not real perl, just because rperl is not smart enough yet.
I don't talk with Will Braswell, But I believe that his target is Rperl will be a compiler for perl which compile all no magic perl code but remain magic perl for perl itself automatically!. That would save a lot of time to manual write C/XS code for performance.
| [reply] |
|
If RPerl ever starts to be able to seamlessly e.g. mix in regexes, use $1, declare lexical vars without types, become able to use a string var as an integer without an explicit conversion, etc etc, then I will of course revise my opinion of it.
Dave.
| [reply] |
Re: About using rperl
by Anonymous Monk on Aug 14, 2019 at 02:31 UTC
|
If I want fast code, I can write it directly in C++, why would I use RPerl?
Why write directly in C++ when you can write directly in perl? rperl writes the c++ for you
| [reply] |