Re: Best way to get a PCRE6 on the JVM?
Am 29.09.2016 um 21:41 schrieb Patrick R. Michaud: On Thu, Sep 29, 2016 at 01:30:29PM +0200, Joachim Durchholz wrote: Can you tell me where the sources for the regex engine live? At the detailed-technical-spec level, I found S05, and I can find the NQP spec, but I don't know my way around the interpreter sources yet. The regex engine lives in src/QRegex of the nqp repository. https://github.com/perl6/nqp/tree/master/src/QRegex Thanks, going to look into it. My hope is that it's possible to use the JVM port of Rakudo to compile the regex engine to JVM bytecode. I'm not entirely familiar with Rakudo's JVM implementation, but I believe that the regex engine portion (supplied by NQP) is _already_ in JVM bytecode. My bad - with "Rakudo", I meant whatever is compiling the regex NQP sources to bytecode. What is the NQP compiler, anyway? Unlike PCRE, the NQP regex library isn't a C-based library that is magically linked into the runtime engine with glue. Indeed. It's a pretty portable design. This should provide quite some synergies. 1) An NQP-based PCRE will be almost guaranteed to have a 100% exact semantics, no excuses. 2) It will even follow the future evolution of Perl regexen. 3) The Perl crowd won't have to deal with subtle corner cases that a PCRE library misimplemented. 4) This provides another incentive to write a backend for yet another platform: beyond Perl6, they also get a pretty powerful and well-designed regex library for any programming language available on that platform. This has all the marks of awesome written over it. Now let's see whether I can make this happen... ;-) Thanks for all the feedback, I think I have enough to get me started. I'll surely be back with more questions as they arise :-D Regards, Jo
Re: Best way to get a PCRE6 on the JVM?
On Thu, Sep 29, 2016 at 01:30:29PM +0200, Joachim Durchholz wrote: > Can you tell me where the sources for the regex engine live? At the > detailed-technical-spec level, I found S05, and I can find the NQP spec, but > I don't know my way around the interpreter sources yet. The regex engine lives in src/QRegex of the nqp repository. https://github.com/perl6/nqp/tree/master/src/QRegex > My hope is that it's possible to use the JVM port of Rakudo to compile the > regex engine to JVM bytecode. I'm not entirely familiar with Rakudo's JVM implementation, but I believe that the regex engine portion (supplied by NQP) is _already_ in JVM bytecode. Unlike PCRE, the NQP regex library isn't a C-based library that is magically linked into the runtime engine with glue. NQP compiles the regex engine (and many of NQP's other components) directly to the target VM's environment. Pm
Re: Best way to get a PCRE6 on the JVM?
Am 28.09.2016 um 15:21 schrieb Will Coleda: To start with, there isn't a PCRE6. Good to know, then this is indeed the right list to discuss this. If you want, more generically, to be able to use Perl 6 Regular Expressions in Java, you can build a rakudo that runs (with reduced functionality) on the JVM. You mean a Perl interpreter that's been stripped down to regex and the bare minimum that it depends on? I'm not sure there's a way at this point to call into the Perl 6 code from arbitrary Java code, however. Arbitrary Java code wouldn't be necessary, it would be a wrapper class that exposes the API needed to whatever people wanted to do with a regex and a string.
Re: Best way to get a PCRE6 on the JVM?
Am 28.09.2016 um 15:46 schrieb Patrick R. Michaud: A simpler approach might be to build an NQP that runs on the JVM, Sounds reasonable, given NQP's position in the toolchain. Not sure what you mean with "build an NQP" - a compiler, a runtime, both, something else? > and find a way to call into it. Seems like the main issue is data types that get exchanged between NQP and Java callers, is that correct or did I overlook something? > (The Perl 6 regular expression engine is written in NQP.) Good to know. The ability to simply run the implementation should reduce the porting effort by orders of magnitude. Also, I can entirely skip porting the test suite, that's one life-long task less to do - sweet. Can you tell me where the sources for the regex engine live? At the detailed-technical-spec level, I found S05, and I can find the NQP spec, but I don't know my way around the interpreter sources yet. My hope is that it's possible to use the JVM port of Rakudo to compile the regex engine to JVM bytecode. That way, Perl6 semantics would be entirely handled by Perl6 itself, and we'd meet at the JVM semantics that's well-understood by both sides. Am I daydreaming, or is that a reasonable way forward? Regards, Jo
[perl #122732] [jvm] control operator crossed continuation barrier
The workaround for JVM has been removed with Rakudo commit c4055e455d. I'm closing this ticket as 'resolved'.
[perl #129763] LTA error when attempting to modify return value within phaser
# New Ticket Created by Aaron Sherman # Please include the string: [perl #129763] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=129763 > Via IRC: [13:51] a very slightly LTA error: [13:51] m: sub test { return (state $x = 0 )++; POST { $_++ } }; say test [13:51] <+camelia> rakudo-moar 58cf9d: OUTPUT«Cannot resolve caller postfix:<++>(Int); none of these signatures match:(Mu:D $a is rw) (Mu:U $a is rw)(Int:D $a is rw)(int $a is rw)(Bool:U $a is rw)(Bool:D $a is rw)(Num:D $a is rw)(Num:U $a is rw)…» [13:52] It really would be nice if the error simply told me that I was trying to modify a non-read-only rather than making me visually parse the "is rw" on all of those. [13:52] Should I rakudobug that? [13:55] harmil_wk: sure, why not -- though I'm not sure the verdict will be "we can haz nice error" on that :/ -- Aaron Sherman, M.: P: 617-440-4332 Google Talk, Email and Google Plus: a...@ajs.com Toolsmith, developer, gamer and life-long student.
[perl #129762] [BUG] Array.clone does not return a properly independent array
# New Ticket Created by Sam S. # Please include the string: [perl #129762] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=129762 > Calling .clone on an Array returns a new Array object, but (even shallow) changes to one affect the other: my $a = [2, 4, 6]; my $b = @a.clone; say $a.WHICH; # Array|68924240 say $b.WHICH; # Array|68924304 @a.push(8); dd $a; # Array $a = $[2, 4, 6, 8] dd $b; # Array $b = $[2, 4, 6, 8] IRC comments: An Array is an object, with a bunch of attributes, once of which is the actual storage. I'm guessing Array doesn't have a method clone of its own, so it does The Default Thing in Mu Which keeps the storage It should probably get its own method clone I thought that had already happened. : :S But yeah, it wants fixing. The current behavior is crap. cue writing spec tests for .clone of pretty much every single class :)
[perl #129761] Missing outer scoped variables in phasers in whenever clauses
# New Ticket Created by "Brian S. Julin" # Please include the string: [perl #129761] # in the subject line of all future correspondence about this issue. # https://rt.perl.org/Ticket/Display.html?id=129761 > It is possible to enter a LAST phaser in a whatever clause in such a way that variables which should be taken from outer scopes are encountered uninitialized. This seems to only happen if the whenever clause has never been normally entered. Maybe it can be golfed down more but so far I got it down this: (10:17:16 AM) skids: m: class A { has $!a = Channel.new; sub s($a) { start { my $r = 42; react { whenever $a { "{$r.VAR.name} == {$r.perl} {$r.VAR.WHICH}".note; LAST { "{$r.VAR.name} == {$r.perl} {$r.VAR.WHICH}".note } } } } }; has $!t = s($!a); method f { $!a.send(0) }; method DESTROY {$!a.close} }; use nqp; A.new.f; for 0..5 {sleep 0.1; nqp::force_gc; Rat.new}; # ok (10:17:17 AM) camelia: rakudo-moar 5a3df8: OUTPUT«$r == 42 Scalar|140475831250104$r == 42 Scalar|140475831250104» (10:17:45 AM) skids: m: class A { has $!a = Channel.new; sub s($a) { start { my $r = 42; react { whenever $a { "{$r.VAR.name} == {$r.perl} {$r.VAR.WHICH}".note; LAST { "{$r.VAR.name} == {$r.perl} {$r.VAR.WHICH}".note } } } } }; has $!t = s($!a); method f { }; method DESTROY { $!a.close } }; use nqp; A.new.f; for 0..5 {sleep 0.1; nqp::force_gc; Rat.new}; # Where'd my 42 go? (10:17:46 AM) camelia: rakudo-moar 5a3df8: OUTPUT«$r == Any Scalar|63362808» (10:18:21 AM) skids: It seems the local variable scope does not get constructed until the whenever gets normally entered.